从闪亮的应用程序创建闪亮的演示文稿?

时间:2014-09-03 21:58:10

标签: r shiny r-markdown

我发现了这个 - http://shiny.rstudio.com/gallery/download-knitr-reports.html - 一个很棒的例子,可以创建静态PDF,HTML和Word文档。

我希望能够做的是上传一个数据集,然后生成一个模板化的闪亮演示文稿。我尝试了多条路线但收效甚微。我得到的最远的是将此代码包含在我的降价文件中:

---
title: "shinyPresentation"
author: "maloneypatr"
date: "Wednesday, September 03, 2014"
output:
  ioslides_presentation:
    self_contained: false
    lib_dir: libs
runtime: shiny
---

尝试下载示例.HTML文件时,出现此错误path for html_dependency not provided。我在追逐目前不存在的功能吗?如果没有,有没有人有一些建议?

提前致谢!

- 易会评论后的更新 -

>library(rmarkdown);library(shiny);sessionInfo()

R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rmarkdown_0.2.47    knitr_1.6           shiny_0.10.1        ggmap_2.3           googleVis_0.5.5    
[6] stringr_0.6.2       gdata_2.13.3        fileR_1.0           plyr_1.8.1          XLConnect_0.2-9    
[11] XLConnectJars_0.2-9 dplyr_0.2           bigrquery_0.1       devtools_1.5        statebins_1.0      
[16] RColorBrewer_1.0-5  gridExtra_0.9.1     scales_0.2.4        ggplot2_1.0.0       httr_0.4           

loaded via a namespace (and not attached):
[1] assertthat_0.1.0.99 bitops_1.0-6        Cairo_1.5-5         caTools_1.17        colorspace_1.2-4   
[6] digest_0.6.4        evaluate_0.5.5      formatR_0.10        gtable_0.1.2        gtools_3.4.1       
[11] htmltools_0.2.4     httpuv_1.3.0        jsonlite_0.9.8      labeling_0.2        magrittr_1.0.1     
[16] mapproj_1.2-2       maps_2.3-7          markdown_0.7        MASS_7.3-33         memoise_0.2.1      
[21] mime_0.1.1          munsell_0.4.2       parallel_3.1.1      png_0.1-7           proto_0.3-10       
[26] psych_1.4.8.11      Rcpp_0.11.2         RCurl_1.95-4.1      reshape2_1.4        RgoogleMaps_1.2.0.6
[31] rJava_0.9-6         rjson_0.2.14        RJSONIO_1.2-0.2     tools_3.1.1         whisker_0.3-2      
[36] xtable_1.7-3        yaml_2.1.13   

这是我更新的报告.Rmd文件:


title: "shinyPresentation"
author: "maloneypatr"
date: "Wednesday, September 03, 2014"
output:
  ioslides_presentation:
    self_contained: false
    lib_dir: libs
runtime: shiny
---

## Shiny Presentation

This R Markdown presentation is made interactive using Shiny. The viewers of the presentation can change the assumptions underlying what's presented and see the results immediately. 

To learn more, see [Interative Documents](http://rmarkdown.rstudio.com/authoring_shiny.html).

## Slide with Interactive Plot

```{r, echo=FALSE}
inputPanel(
  selectInput("n_breaks", label = "Number of bins:",
              choices = c(10, 20, 35, 50), selected = 20),

  sliderInput("bw_adjust", label = "Bandwidth adjustment:",
              min = 0.2, max = 2, value = 1, step = 0.2)
)

renderPlot({
  hist(faithful$eruptions, probability = TRUE, breaks = as.numeric(input$n_breaks),
       xlab = "Duration (minutes)", main = "Geyser eruption duration")

  dens <- density(faithful$eruptions, adjust = input$bw_adjust)
  lines(dens, col = "blue")
})
```

1 个答案:

答案 0 :(得分:7)

  

我是否在追逐目前尚不存在的功能?

一点点。 : - )

交互式闪亮演示文稿(和文档)无法保存为HTML。他们需要一台服务器来运行它们包含的R代码。发生的事情是您的应用程序正在尝试将交互式演示文稿呈现为静态HTML文件,这是不受支持的。

简短的回答是,您需要一个“运行”代替“下载”,它会调用rmarkdown::run而不是rmarkdown::render

如果您正在寻找可下载的资产,那么您可以做的最好的事情就是下载.Rmd本身,并为当前的UI状态添加适当的字符串替换;然后可以随时使用rmarkdown::run运行.Rmd。

相关问题