Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
错误:如果没有活动-反应上下文,则不允许操作(在闪亮的&x2B;flexdashboard中)_R_Shiny_Flexdashboard - Fatal编程技术网

错误:如果没有活动-反应上下文,则不允许操作(在闪亮的&x2B;flexdashboard中)

错误:如果没有活动-反应上下文,则不允许操作(在闪亮的&x2B;flexdashboard中),r,shiny,flexdashboard,R,Shiny,Flexdashboard,我正在学习Shining+flexdashboard。我阅读了stackoverflow帖子中关于我得到的错误声明,但我仍然无法理解我的具体情况(可能是因为我是这方面的初学者) 下面是生成错误的代码 如果在代码的最后一行,而不是 col=输入$plot\u颜色) 我用 col=“brown”) 我把头撞在墙上,想弄明白为什么 col=input$line_color在Geyser页面上的Geyser绘图中有效,但col=input$plot_color在Pg页面测试绘图中无效 --- 标题:“

我正在学习Shining+flexdashboard。我阅读了stackoverflow帖子中关于我得到的错误声明,但我仍然无法理解我的具体情况(可能是因为我是这方面的初学者)

下面是生成错误的代码

如果在代码的最后一行,而不是 col=输入$plot\u颜色) 我用 col=“brown”)

我把头撞在墙上,想弄明白为什么 col=input$line_color在Geyser页面上的Geyser绘图中有效,但col=input$plot_color在Pg页面测试绘图中无效


---
标题:“老忠实喷发”
输出:flexdashboard::flex_仪表板
运行时间:闪亮
---
```{r全局,include=FALSE}
#在“全局”块中加载数据,以便仪表板的所有用户都可以共享该数据
图书馆(数据集)
图书馆(readr)
数据(忠实)
```
页式间歇泉
===================================== 
列{.sidebar数据宽度=300}
----------------------------------------------------------------------
来自http://rmarkdown.rstudio.com/flexdashboard/shiny.html
火山喷发之间的等待时间和火山喷发持续时间
美国怀俄明州黄石国家公园的老忠实间歇泉。
```{r selectInput}
#评论这里
颜色。选项=c(“蓝色”、“红色”、“黑色”)
选择输入(“n_breaks”,label=“料仓数量:”,
选择=c(10,20,35,50),选择=20)
选择输入(“线条颜色”,label=“线条颜色:”,
选项=color.choices,selected=“red”)
滑块输入(“bw_调整”,label=“带宽调整:”,
最小值=0.2,最大值=2,值=1,步长=0.2)
```
列{数据宽度=650}
-----------------------------------------------------------------------
###间歇泉喷发持续时间历史
```{r renderPlot_间歇泉}
渲染图({
hist(忠实$喷发,概率=真,中断=数值(输入$n_中断),
xlab=“持续时间(分钟)”,main=“间歇泉喷发持续时间”)

dens只需将绘图指令放入一个
renderPlot()
中即可使用反应值,您需要使用
renderPlot()
。这就是为什么它在第一个块上有效,而在第二个块上无效的原因。因此,在图表块中使用
renderPlot(绘图(1:10,…)
。HubertL,Omaimas,非常感谢。它有效!
---
title: "Old Faithful Eruptions"
output: flexdashboard::flex_dashboard
runtime: shiny
---


```{r global, include=FALSE}
# load data in 'global' chunk so it can be shared by all users of the dashboard
library(datasets)
library(readr)
data(faithful)


```


Page Geyser
===================================== 

Column {.sidebar data-width=300}
----------------------------------------------------------------------



Example from http://rmarkdown.rstudio.com/flexdashboard/shiny.html
Waiting time between eruptions and the duration of the eruption for the
Old Faithful geyser in Yellowstone National Park, Wyoming, USA.

```{r selectInput}


# Comment here
color.choices=c("blue", "red", "black")
selectInput("n_breaks", label = "Number of bins:",
            choices = c(10, 20, 35, 50), selected = 20)

selectInput("line_color", label = "Coor of line:",
            choices = color.choices, selected = "red")

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




Column {data-width=650}
-----------------------------------------------------------------------


### Geyser Eruption Duration Hist

```{r renderPlot_Geyser}
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 = input$line_color)
})
```


Pg Test plots
===================================== 


  Column {.sidebar data-width=500}
----------------------------------------------------------------------


```{r selectInput_page_2}


# Comment here
color.choices2=c("blue", "red", "brown", "green")

selectInput("multiplier_for_x", label = "Y= x*:",
            choices = c(1, 2, 3, 5), selected = 2)

selectInput("plot_color", label = "Color of plot:",
            choices = color.choices2, selected = "brown")

```


Column {data-width=350}
-----------------------------------------------------------------------

  ### Chart B

```{r chart_b}
 plot(1:10, 
                         1:10, 
                         main="Plot in chart B section of code", 
                         sub="Y= x*:",
                         col=input$plot_color) 
```