2017-02-10 98 views
3

我最近創建了一個網站。我現在想擁有一個突出顯示基本Shiny功能的頁面。這可以使用runtime: shiny選項用於正常降價文檔。然而,當我使用這個:rmarkdown網站和HTML依賴關係中的閃亮應用

--- 
title: "Untitled" 
runtime: shiny 
output: html_document 
--- 

```{r setup, include=FALSE} 
knitr::opts_chunk$set(echo = TRUE) 
``` 

```{r} 
inputPanel(
      sliderInput("obs", "observations:", min = 10, max = 500, value = 100) 
      ) 
      renderPlot({hist(rnorm(input$obs), col = 'darkgray', border = 'white')}) 
``` 

,並嘗試建立的網站,我收到以下錯誤:

enter image description here

我確信我所有的包都是最新的。

我感覺我可能會從根本上誤解網站(和Shiny)是如何工作的,但我不能找到在authoring Shiny文件,embedded Shiny頁明確回答我的問題或rmarkdown website指南。

這是否是Shiny應用程序不能以這種方式在網站上部署?或者我只是密集?

編輯:輸出sessionifo()

> sessionInfo() 
R version 3.3.2 (2016-10-31) 
Platform: x86_64-pc-linux-gnu (64-bit) 
Running under: Antergos Linux 

locale: 
[1] LC_CTYPE=en_US.UTF-8  LC_NUMERIC=C    
[3] LC_TIME=en_US.UTF-8  LC_COLLATE=en_US.UTF-8  
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 
[7] LC_PAPER=en_US.UTF-8  LC_NAME=C     
[9] LC_ADDRESS=C    LC_TELEPHONE=C    
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C  

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

loaded via a namespace (and not attached): 
[1] backports_1.0.5 magrittr_1.5 rprojroot_1.2 htmltools_0.3.5 
[5] tools_3.3.2  yaml_2.1.14  Rcpp_0.12.9  stringi_1.1.2 
[9] rmarkdown_1.3 knitr_1.15.1 stringr_1.1.0 digest_0.6.12 
[13] evaluate_0.10 
+0

您應該將'sessionInfo()'命令的輸出添加到此,以便我們可以確切地看到您正在處理的內容。 –

+0

用'sessionInfo()'輸出編輯的文章。 – Scott

回答

0

當您在R-降價用閃亮的控制,你不嵌入應用程序,您嵌入應用程序的部分。例如,如果你想要做的是,在R-降價閃亮的應用程序,你可以使用這個代碼:

--- 
title: "Untitled" 
runtime: shiny 
output: html_document 
--- 

```{r setup, include=FALSE} 
knitr::opts_chunk$set(echo = TRUE) 
``` 

```{r} 
    inputPanel(
     sliderInput("obs", "observations:", min = 10, max = 500, value = 100) 
    ) 
    renderPlot({hist(rnorm(input$obs), col = 'darkgray', border = 'white')}) 
``` 

其中產量這個當編譯(和控制工作和劇情更新):

enter image description here

+0

邁克 - 當嘗試呈現網站時,這也不起作用;相同的錯誤信息。我將採取這個代碼塊並重新修改我的問題,因爲我收到的回覆似乎並沒有明確說明問題所在。 – Scott