我在R中做了一个演示,使用了reveal.js模板之一(使用revealjs R包).
默认情况下,它生成一个html文件,当打开它进行演示时,它显示浏览器的顶部部分,包括书签,文件路径等...我可以关闭书签栏而不是文件路径部分,我需要在正式设置中显示这个将演示文稿导出为pdf似乎是一个更好的选择.
有谁知道如何将其导出为PDF格式?我可以在YAML标题中添加任何内容,以便输出为pdf而不是html吗?
下面是示例代码,它生成"test.html"文件.我想生成"test.pdf",同时保留演示文稿的所有其他属性,例如转换,交互式绘图等...
---
title: "test"
output: revealjs::revealjs_presentation
---
## R Markdown
This is an R Markdown presentation. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.
## Slide with Bullets
- Bullet 1
- …Run Code Online (Sandbox Code Playgroud) 我有一个包含 50000 行和 200 列的数据框。数据中有重复的行,我想通过使用 R 中的聚合函数在重复项中选择具有最大变异系数的行来聚合数据。使用聚合,我可以默认使用“mean”、“sum”,但不能使用系数变化.
例如
aggregate(data, as.columnname, FUN=mean)
Run Code Online (Sandbox Code Playgroud)
工作正常。
我有一个用于计算变异系数的自定义函数,但不确定如何将它与聚合一起使用。
co.var <- function(x)
(
100*sd(x)/mean(x)
)
Run Code Online (Sandbox Code Playgroud)
我试过了
aggregate(data, as.columnname, function (x) max (co.var (x, data[index (x),])
Run Code Online (Sandbox Code Playgroud)
但它给出了一个错误,因为找不到对象 x。