简体   繁体   English

RMarkdown:使用Rcpp中的rmarkdown:render-function生成pdf文档

[英]RMarkdown: Generate pdf document using rmarkdown:render-function in Rcpp

I want to generate pdf document from my .rmd file with the rmarkdown:render-function. 我想使用rmarkdown:render-function从我的.rmd文件生成pdf文档。 It works when I execute the render-function from RStudio and also RGui after setting some environment variables: 设置一些环境变量后,当我从RStudio和RGui执行渲染功能时,它会起作用:

Sys.setenv(PATH = paste(Sys.getenv('PATH'), 'C:/Program Files/MiKTeX 2.9/miktex/bin/x64', sep=.Platform$path.sep))

Sys.setenv(RSTUDIO_PANDOC='C:/Program Files/RStudio/bin/pandoc')

I also use R integration in C++ with the Rcpp package, so I can execute R Code out of C++. 我还使用Rcpp软件包在C ++中使用R集成,因此我可以在C ++之外执行R代码。 For some reason the render-function doesn't work when I call it via Rcpp. 由于某些原因,当我通过Rcpp调用渲染功能时,该渲染功能不起作用。 Maybe it has to do with the environvent variables? 也许与环境变量有关? Any ideas? 有任何想法吗?

I think you need to take care of the PATH before you start R to affect processes started by it. 我认为启动R来影响它所启动的进程之前,您需要注意PATH

Also, it's Rcpp (with lowercase c, p and p) and it "works for me" when all tools are in the PATH . 另外,它是Rcpp(具有小写的c,p和p),并且当所有工具都位于PATH时,它“对我有用”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM