Skip to content

Instantly share code, notes, and snippets.

@estsaon
Last active March 16, 2021 21:55
Show Gist options
  • Save estsaon/cefdb65a4163f70edd2d39d0a0f128d8 to your computer and use it in GitHub Desktop.
Save estsaon/cefdb65a4163f70edd2d39d0a0f128d8 to your computer and use it in GitHub Desktop.
How to install R Markdown and render PDF files in Linux
  1. Install necessary packages for R Markdown:
sudo apt install r-base
sudo apt install texlive-latex-base
sudo apt install texlive-latex-extra
sudo apt install texlive-extra-utils
sudo apt install texlive-fonts-extra
sudo apt install pandoc
  1. Change R library installation path to ~/.local/R to avoid permission issues:
echo "R_LIBS_USER='~/.local/R/x86_64-pc-linux-gnu-library/3.6'" > ~/.Renviron
dir.create(Sys.getenv("R_LIBS_USER"), recursive=TRUE)
.libPaths(Sys.getenv("R_LIBS_USER"))
  1. Install R Mardown:
install.packages("rmarkdown")
rmarkdown::render("*.Rmd")

https://cran.r-project.org/web/packages/startup/vignettes/startup-intro.html

https://knausb.github.io/2017/07/r-3.4.1-personal-library-location/

https://stackoverflow.com/questions/32540919/library-is-not-writable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment