Rstudio转换为PDF [英] Rstudio knit to PDF
问题描述
Rstudio(0.98.932)的新版本具有许多新选项,包括编织到PDF".描述新版本的文章有戴夫(Dave)的评论,内容为:
The new version of Rstudio (0.98.932) has many new options including knit to PDF. An article describing the new version has a comment from Dave that says:
...在安装rstudio 0.98.932之后,我没有看到下拉菜单 编辑.Rmd文件时用于编织pdf或word.
...after installing rstudio 0.98.932 I don’t get the little dropdown menu for knit-pdf or word when editing a .Rmd file.
我遇到了同样的问题.发布了一个有用的回复:
I'm having the same issue. A helpful response was posted:
可能是:
a)您没有运行R 3.0(RMarkdown v2必需);或
a) You are not running R 3.0 (which is required for RMarkdown v2); or
b)您定义了一个自定义的markdown渲染器(markdownToHTML 选项).您可以通过执行以下操作进行检查:
b) You have a custom markdown renderer defined (markdownToHTML option). You can check for this by executing:
getOption("rstudio.markdownToHTML")
getOption("rstudio.markdownToHTML")
这解决了Dave的问题(b),但是当我运行该命令时,我得到了NULL
That solved Dave's problem (b), but when I run that command I get NULL
> getOption("rstudio.markdownToHTML")
NULL
我认为这意味着我没有定义自定义markdown渲染器. (以前我是在自定义的.Rprofile
中进行的,但是我删除了它.)我的R版本是3.1.0.
Which I assume means I don't have a custom markdown renderer defined. (Previously I did in a cusomized .Rprofile
, but I removed that.) My R version is 3.1.0.
我误解了getOption
命令吗?可能是我的Rstudio绊倒了吗?
Am I misunderstanding the getOption
command? Could something else be tripping up my Rstudio?
推荐答案
我刚刚安装了RStudio的新版本(0.98.932),这促使我升级了几个软件包(尽管我记不清哪个,我看到我有knitr 1.6,markdown 0.7和rmarkdown 0.2.46).起初我有同样的问题.工具栏上只有一个编织"选项.通过在我的.Rmd文件的开头添加以下内容,我设法能够编织成.pdf.
I have just installed the new version of RStudio (0.98.932), which prompted me to upgrade a couple of packages (I can't remember which, although I see I have knitr 1.6, markdown 0.7 and rmarkdown 0.2.46). At first I had the same problem; there was only a single 'knit' option on the tool bar. I managed to get the ability to knit to .pdf by adding the following to the head of my .Rmd file.
---
title: "Sample Document"
output: pdf_document
---
这样做之后,我现在发现我确实有一个下拉菜单,其中包含用于编织为HTML,PDF和word的选项.还有一个小齿轮图标,可用来访问以前没有的R Markdown文档选项.我不知道问题出在哪里,但现在看来还可以!
Having done that, I now find I do have a drop down menu with options to knit to HTML, PDF and word. There's also a little gear icon that provides access to the R Markdown document options that wasn't there before. I have no idea what the problem was but it seems OK now!
这篇关于Rstudio转换为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!