r - Paths in ssh versus Rstudio server for pandoc and knitr -


i running rstudio aws instance using premade ami (http://www.louisaslett.com/rstudio_ami/). using able boot rstudio server. can create default .rmd file , knit without problem. normal message @ end (pasted, path may relavent).

/usr/lib/rstudio-server/bin/pandoc/pandoc +rts -k512m -rts test.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output test.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template /usr/local/lib/r/site-library/rmarkdown/rmd/h/default.html --variable 'theme:bootstrap' --include-in-header /tmp/rtmpen2em3/rmarkdown-str156c3b3566c1.html --mathjax --variable 'mathjax-url:https://cdn.mathjax.org/mathjax/latest/mathjax.js?config=tex-ams-mml_htmlormml' --no-highlight --variable highlightjs=/usr/local/lib/r/site-library/rmarkdown/rmd/h/highlight  

furthermore, can go shell rstudio options tools -> shell , type

rscript -e "rmarkdown::render("test.html")" 

and knits fine.

however, when ssh same instance (git bash terminal), , try render same document same line of code. get:

    ubuntu@ip-172-31-17-88:/home/rstudio$ rscript -e "rmarkdown::render("test.html")" error: pandoc version 1.12.3 or higher required , not found. execution halted 

is there behavior paths in ssh misunderstanding?

if type:

pandoc program 'pandoc' not installed. can install typing: sudo apt-get install pandoc 

then how rstudio server able knit html?

rstudio sets environment variable rstudio_pandoc directory contains pandoc binaries shipped rstudio ide/server. when call rmarkdown::render(), rmarkdown tries find pandoc environment variable.

of course, environment variable exists when run programs inside rstudio ide/server, unlikely set outside rstudio. either add rstudio pandoc directory path, or run inside rstudio.

path=/usr/lib/rstudio-server/bin/pandoc/:$path rscript -e "rmarkdown::render("test.rmd")" 

and can install pandoc via apt-get install, i'm not sure if sufficient version of pandoc exists in ubuntu distribution.


Comments