简体   繁体   English

用knitr编译* .Rnw文件 - 没有Rstudio

[英]Compiling *.Rnw files with knitr --without Rstudio

I would like to use knitr to create presentations that embed R objects and code. 我想使用knitr创建嵌入R对象和代码的演示文稿。

For IT reasons I am restricted to vim, so i have found the available Rstudio+knitr examples fairly unhelpful. 由于IT的原因,我被限制为vim,所以我发现可用的Rstudio + knitr示例相当无益。 The vim section of the knitr documents is also very skinny, and therefore unhelpful. knitr 文件的vim部分也非常瘦,因此无益。

Is someone able to provide some guidance on how to compile a *.Rnw or *.Rmd file using knitr (or alternately point me to a decent online tutorial?) using some combination of vim , R , and the command line? 是否有人能够使用knitr (或者让我指向一个体面的在线教程?)使用vimR和命令行的某些组合来提供有关如何编译*.Rnw*.Rmd文件的一些指导?

thanks in advance 提前致谢

Instead of going through Rstudio, you can use the functions in the knitr package directly. 您可以直接使用knitr包中的函数,而不是通过Rstudio。 There are some options you can tweak, but to get started, all you have to do is call the knit() function on your .Rnw file: 您可以调整一些选项,但要开始使用,您只需要调用.Rnw文件中的knit()函数:

library(knitr)
knit('my_input.Rnw')

If you're missing some of Rstudio's features, it's worth remembering that most of them are just making use of things that are already available in various R packages, so you can usually find a way to use them when you don't have Rstudio available. 如果您错过了Rstudio的一些功能,那么值得记住的是,他们中的大多数只是使用了各种R包中已有的功能,因此当您没有Rstudio可用时,通常可以找到使用它们的方法。

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

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