rstudio怎么导入html,在RStudio预览版中编织Html的问题

我已经问过相关问题

here,

here和

here.

目标

我有一个很长的Rmd文件(保存在R项目中),我想用目录编织成Html和PDF.

问题背景

我之前使用的是RStudio 0.98.501.设置是:

>文档顶部没有目录(TOC)命令

>外部图像的绝对路径

>全局块选项中的cache = TRUE

当我第一次点击knitHtml按钮创建新文件夹时:数字,缓存,knitHTML等等.没有问题,一切正常.但后来我决定添加TOC.使用Rmarkdown Version 2 page的“输出选项”部分,我在顶部添加了toc命令,单击了knitHtml按钮,但获得了与之前完全相同的输出,没有任何TOC.所以,我决定升级到RStudio Preview版本.

当前的问题状态

更新到预览版后,我打开了项目并单击了knitHtml按钮.它给出了一个错误,即找不到其中一个外部图像.因此,在谢毅辉的建议下,我做了以下事情:

>复制前一个R中创建的所有外部图像和图形

编织到Rmd文件所在的文件夹.这是项目目录中的knitHtml文件夹.

>所有外部图像的相对路径

>全局块选项中的cache = TRUE

然后我点击knitHTML按钮并得到以下错误:

output file: Trajectory1-new.knit.md

"C:/Program Files/RStudio/bin/pandoc/pandoc" Trajectory1-new.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output Trajectory1-new.html --smart --email-obfuscation none --self-contained --standalone --section-divs --table-of-contents --toc-depth 3 --template C:\Users\durraniu\Documents\R\win-library\3.0\rmarkdown\rmd\h\default.html --variable theme:united --include-in-header C:\Users\durraniu\AppData\Local\Temp\Rtmp0OFfmZ\rmarkdown-str10186bd23276.html --mathjax --variable mathjax-url:https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML --no-highlight --variable highlightjs=C:\Users\durraniu\Documents\R\win-library\3.0\rmarkdown\rmd\h\highlight

pandoc.exe: Could not find data file ./Trajectory1-new_files/figure-html/pdf_velocity.png

Error: pandoc document conversion failed with error 97

In addition: Warning messages:

1: In if (grepl(" ", path, fixed = TRUE)) path

the condition has length > 1 and only the first element will be used

2: running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" Trajectory1-new.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output Trajectory1-new.html --smart --email-obfuscation none --self-contained --standalone --section-divs --table-of-contents --toc-depth 3 --template C:\Users\durraniu\Documents\R\win-library\3.0\rmarkdown\rmd\h\default.html --variable theme:united --include-in-header C:\Users\durraniu\AppData\Local\Temp\Rtmp0OFfmZ\rmarkdown-str10186bd23276.html --mathjax --variable mathjax-url:https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML --no-highlight --variable highlightjs=C:\Users\durraniu\Documents\R\win-library\3.0\rmarkdown\rmd\h\highlight' had status 97

Execution halted

所以,我尝试编织PDF并且它有效.输出与预期一致.然后我在全局块选项中更改为cache = FALSE并单击编织HTML.花了很长时间(我的文件有很多分析)并给出了带有TOC的html文件作为输出,我需要的.

我的问题是,为什么我必须将cache = FALSE用于创建html,当缓存= TRUE适用于RStudio预览版中的PDF时?我只能在添加一个部分后每次等待15-20分钟才能看到输出.我该如何解决这个问题?

编辑

以下是前面的事情:

---

title: "Sample Document"

output:

html_document:

theme: united

toc: yes

---

Trajectory: 7:50 am - 8:05 am (t1)

========================================================

```{r setup}

# set global chunk options:

library(knitr)

opts_chunk$set(cache=TRUE, fig.align='center')

```

```{r alllibraries, echo=FALSE}

library(ggplot2)

library(plyr)

library(data.table)

library(parallel)

library(xtable)

library(ggthemes)

suppressPackageStartupMessages(library(googleVis))

my.theme

{theme(plot.title = element_text(size = rel(2)), panel.grid.major=element_line(color='grey'), panel.grid.minor=element_line(color='grey', linetype='dashed'), legend.position='bottom', legend.background = element_rect(colour = "black"), strip.text = element_text(size=13, lineheight=2))

}

```

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值