R:转换;rmarkdown“;至;html";文件夹
我正在使用R编程语言。我正试图从这个网站上重新创建交互式“仪表板”:(代码在这个网站上提供) 首先,我运行此代码以访问“flexdashboard模板生成器”: 然后,我删除了弹出窗口中的所有文本。我将R代码从网站()复制到此窗口并单击“保存”: 此文件(“dashboard.Rmd”)保存在“我的文档”中(也已设置为默认工作目录): 现在,我想“查看”仪表板并将仪表板“保存”为“.html”文件。我发现了另一个stackoverflow帖子,展示了如何解决这个问题: 我试着按照这篇stackoverflow帖子上提供的答案之一中的步骤进行操作:R:转换;rmarkdown“;至;html";文件夹,html,r,r-markdown,data-visualization,knitr,Html,R,R Markdown,Data Visualization,Knitr,我正在使用R编程语言。我正试图从这个网站上重新创建交互式“仪表板”:(代码在这个网站上提供) 首先,我运行此代码以访问“flexdashboard模板生成器”: 然后,我删除了弹出窗口中的所有文本。我将R代码从网站()复制到此窗口并单击“保存”: 此文件(“dashboard.Rmd”)保存在“我的文档”中(也已设置为默认工作目录): 现在,我想“查看”仪表板并将仪表板“保存”为“.html”文件。我发现了另一个stackoverflow帖子,展示了如何解决这个问题: 我试着按照这篇stac
require(knitr) # required for knitting from rmd to md
require(markdown) # required for md to html
markdownToHTML('dashboard.Rmd', 'test.html')
但这产生了以下输出(不正确):
而不是期望的输出:
有人能告诉我我做错了什么,我如何解决这个问题(即获得所需的输出)
谢谢在
dashboard.Rmd中保存文件后,单击Knit->Knit to flex_dasboard
这将在RStudio中打开仪表板模板。这还会自动在工作目录中创建一个同名的HTML文件(dashboard.HTML
)
谢谢您的回答!有没有办法编写代码来执行“knit to flex_dashboard”操作?我在视图中看不到“knit”选项:。感谢您的帮助rmarkdown::render(input=“dashboard.Rmd”,output_file=“main.html”)
对我有用。注意:我的计算机上只有R studio(版本3.4.1)(我无法升级或下载其他版本的R,没有internet连接或USB端口)。谢谢你的回复!我之前也尝试过这段代码,但出现了以下错误:>rmarkdown::render(input=“dashboard.Rmd”,output_file=“main.html”)在yaml::yaml.load(…,eval.expr=TRUE)中出错:解析器错误:在第2行第1列中未找到预期值。。。你知道是什么导致了这个错误吗?谢谢你的帮助,现在对你有用吗?
---
title: "rbokeh iris dataset"
author: "Ryan Hafen"
output:
flexdashboard::flex_dashboard:
orientation: columns
social: menu
source_code: embed
---
```{r setup, include=FALSE}
library(rbokeh)
library(flexdashboard)
```
Column {data-width=600}
-----------------------------------------------------------------------
### Species
```{r}
figure(width = NULL, height = NULL) %>%
ly_points(Sepal.Length, Sepal.Width, data = iris, color = Species)
# figure() %>%
# ly_points(Sepal.Length, Sepal.Width, data = iris,
# color = Species, glyph = Species)
```
Column {data-width=400}
-----------------------------------------------------------------------
### Species (Quantile)
```{r}
figure(width = NULL, height = NULL, legend_location = "top_left") %>%
ly_quantile(Sepal.Length, group = Species, data = iris)
```
### Petal Width
```{r}
figure(width = NULL, height = NULL) %>%
ly_points(Sepal.Length, Sepal.Width, data = iris,
color = Petal.Width)
```
require(knitr) # required for knitting from rmd to md
require(markdown) # required for md to html
markdownToHTML('dashboard.Rmd', 'test.html')