2017-02-10 46 views
2

是否可以將此交互式降價報告轉換爲html並將其保存爲特定文件夾(目標是使此報告保持在R之外)?如果是,如何?將Markdown保存爲交互式HTML

--- 
runtime: shiny 
output: html_document 
---  

```{r echo=FALSE} 
N<-c('A','B','C'); V<-c(60,50,80); mydf<-data.frame(N,V) 
selectInput("sel","Select:",choices = as.character(mydf$N)) 
renderText({ 
    paste("The result is:",mydf[mydf$N==input$sel,2]) 
}) 
``` 

感謝&親切的問候

回答

1

從Rstudio(旁邊run document)的設置,選擇Preview in Viewer Panel。這將使用您的瀏覽器而不是Rstudio的內置瀏覽器。

然後你會看到HTML文件保存在硬盤上:

processing file: testing_interactive.Rmd 

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS "C:/Users/TB/AppData/Local/Temp/RtmpKYheKO/testing_interactive.utf8.md" --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pandoc83c74213d5c.html --smart --email-obfuscation none --standalone --section-divs --template "C:\Rlibs\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --mathjax --variable "mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --id-prefix section- 
output file: C:/Users/TB/AppData/Local/Temp/RtmpKYheKO/testing_interactive.knit.md 


Output created: C:/Users/TB/AppData/Local/Temp/RtmpKYheKO/file83c15d05b9c.html 
+0

謝謝,但似乎我聽錯了,從一開始。我做的是(在R Studio中): 1.文件>新建文件> R Markdown .. // 2.演示文稿和HTML(Slidy)// 3.確定// 4.複製上面的代碼// 5 。編織HTML>編織爲HTML(Slidy)// 6.(點擊齒輪符號)僅提供「輸出選項..」 –

+0

如果我使用ioslides,可用選項有View Pane,View in Window,Output Options .. –

+0

是的。即使你在ioslides上,也就是說你的前端事物會有'output:ioslides_presentation'(默認值),通過選擇'View Pane',將會以上述相同的方式顯示html文件路徑。 – LyzandeR