Last active
March 2, 2018 23:38
-
-
Save murraycadzow/2934c1dc4fc4dfa7e974 to your computer and use it in GitHub Desktop.
Text file of useful R or Rmd things
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if rJava package in R fails to install run: "sudo R CMD javareconf" in bash | |
Be able to knit rmarkdown from cmd line | |
first soft link Rstudios pandoc: | |
Newer Systems (Debian/Ubuntu/Fedora/RHEL6+) | |
For newer Linux systems you can make a standalone version of pandoc v1.12.3 available to the system by soft-linking the binaries included with RStudio: | |
$ sudo ln -s /usr/lib/rstudio/bin/pandoc/pandoc /usr/local/bin | |
$ sudo ln -s /usr/lib/rstudio/bin/pandoc/pandoc-citeproc /usr/local/bin | |
then: | |
R CMD -e 'rmarkdown::render("input.Rmd") | |
Possibly a better way: | |
Go into RStudio and find the system environment variable for RSTUDIO_PANDOC | |
Sys.getenv("RSTUDIO_PANDOC") | |
Then put that in your R script prior to calling the render command. | |
Sys.setenv(RSTUDIO_PANDOC="--- insert directory here ---") | |
run rstudio from cmd line with particular install of R: | |
export RSTUDIO_WHICH_R=/usr/local/bin/R | |
Dual output and table of contents created on knit: | |
--- | |
title: "title" | |
author: "name" | |
date: '`r format(Sys.Date())`' | |
output: | |
pdf_document: | |
toc: yes | |
html_document: | |
toc: yes | |
--- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment