简体   繁体   English

无法将 RStudio 编入 HTML 文档

[英]Can't knit an RStudio into an HTML document

I have an RStudio session open and need to knit it into an HTML document.我有一个 RStudio session 打开,需要将它编织到 HTML 文档中。 I'm trying to do it through the knit button but I'm getting a popup that says this:我正在尝试通过 knit 按钮执行此操作,但我收到一个弹出窗口,上面写着:

Loading required package: knitr Warning message: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called 'knitr' Error in knit("jorge_perez_ruano_uber_final.Rhtml", encoding = "UTF-8"): could not find function "knit" Execution halted加载所需的 package:knitr 警告消息:在库中(包,lib.loc = lib.loc,character.only = TRUE,logical.return = TRUE,:没有 package 称为 'knitr' knit 中的错误(“ruano_uber_final.Rorge_perez ", encoding = "UTF-8"): 找不到 function "knit" 执行停止

knitr terminated with status 1 knitr 以状态 1 终止

I have installed the markdown package and also tried to run the render function but it's giving me another error:我已经安装了 markdown package 并且还尝试运行渲染 function 但它给了我另一个错误:

Error in render("path/to/file.Rmd"): could not find function "render"渲染错误(“path/to/file.Rmd”):找不到 function“渲染”

Anyone knows how to help?任何人都知道如何帮助?

The error is in the error - you did not have knitr installed.错误在错误中-您没有安装knitr

Install the package with install.packages("knitr") , and you should be ready to go.使用install.packages("knitr")安装 package,您应该准备好 go。 Remember that the markdown environment should be considered separate from the global environment, and as such you need to load relevant libraries and code in a code chunk before it is accessible.请记住,markdown 环境应被视为与全局环境分开,因此您需要在代码块中加载相关库和代码,然后才能访问它。 Here is a good introduction to the topic .这是对该主题的一个很好的介绍

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

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