Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

465
Views
¿Cómo usar Docker para convertir Rmarkdown a HTML?

¿Cómo convertir el siguiente test.rmd usando Docker para dar una salida como un documento .html ?

No puedo encontrar un ejemplo corto y simple aquí sin requerir que RStudio esté configurado en un contenedor acoplable.

prueba.rmd

 --- title: "Test" author: "John Doe" date: "5/15/2019" output: html_document: theme: lumen --- ## R Markdown Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ## Scatter Plot ```{r} library(ggplot2) ggplot(mpg, aes(displ, hwy, colour = class)) + geom_point() ``
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Aquí hay una respuesta para usted (con dos correcciones/cambios) basada en un contenedor Rocker que hice para Rmd y que tenía localmente. Es bastante mínimo: R más rmarkdown más una pila completa de LaTeX (ese aspecto me importaba, puede que a ti no) y poco más, pero ggplot2 . Puede descargarlo con un docker pull rocker/r-rmd estándar desde la cuenta de Rocker en Docker Hub .

Tuve que hacer dos cambios en su archivo Rmd. Primero, agregué el tercer acento grave que faltaba en la última línea. Luego, también tuve que eliminar el tema del lumen. Eso puede venir de otro paquete, no lo recuerdo. Después de eso, el siguiente comando funciona (y su ejemplo se guarda como file.Rmd ):

 docker run --rm -ti -v${PWD}:/work -w/work \ rocker/r-rmd Rscript -e 'rmarkdown::render("file.Rmd")'

Registro de salida en mi caja

 edd@rob:~/git/stackoverflow/56157292(master)$ docker run --rm -ti -v${PWD}:/work -w/work rocker/r-rmd Rscript -e 'rmarkdown::render("file.Rmd")' processing file: file.Rmd |................................ | 50% ordinary text without R code |.................................................................| 100% label: unnamed-chunk-1 output file: file.knit.md /usr/bin/pandoc +RTS -K512m -RTS file.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output file.html --email-obfuscation none --self-contained --standalone --section-divs --template /usr/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /tmp/Rtmp6683qu/rmarkdown-str1417442cc.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' Output created: file.html edd@rob:~/git/stackoverflow/56157292(master)$

Salida renderizada

ingrese la descripción de la imagen aquí

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!