Rmarkdown和Shining输入
我正在尝试我的第一个降价文件,在那之前一切都很顺利 我得到了错误 用这块Rmarkdown和Shining输入,r,shiny,r-markdown,R,Shiny,R Markdown,我正在尝试我的第一个降价文件,在那之前一切都很顺利 我得到了错误 用这块 {r, echo=FALSE} inputPanel( radioButtons("category",label= "Select Category",choices=c("diffPts","diffGF","diffGA","diffGD","diffpos"),inline = TRUE) ) renderPlot({ ggplot(clubSeason, aes(x=team, y=input$c
{r, echo=FALSE}
inputPanel(
radioButtons("category",label= "Select Category",choices=c("diffPts","diffGF","diffGA","diffGD","diffpos"),inline = TRUE)
)
renderPlot({
ggplot(clubSeason, aes(x=team, y=input$category)) + geom_boxplot()
})
如果我硬编码,例如y=“diffPts”
,则显示图表。在ggplot周围放置一个print()
,没有帮助
TIA以下对我来说运行良好。ìnput$category`的值按预期打印
---
title: "Untitled"
runtime: shiny
output: html_document
---
```{r, echo=FALSE}
library(ggplot2)
inputPanel(
radioButtons("category",label= "Select Category",choices=c("diffPts","diffGF","diffGA","diffGD","diffpos"),inline = TRUE)
)
renderPlot({
print(input$category)
ggplot(faithful, aes(x=eruptions, y=waiting)) + geom_boxplot()
})
```
更新:
问题似乎是aes
函数被传递了一个字符串。您可以使用aes\u字符串
:
renderPlot({
ggplot(clubSeason, aes_string(x='team', y=input$category)) + geom_boxplot()
})
请提供一个最小的可复制示例.Tx。我认为问题可能是input$category是说“diffPts”,而我需要它是diffPts。我肯定有办法解决这个问题,但我想不起来了offhand@pssguy可能使用aes_字符串(x='team',y=input$category),而不是直接调用aes。如果你能给出一个重复的例子来说明这个错误,我想像
aes\u string
这样的东西可能会起作用。这似乎是一个解决方案!我以前没见过,非常感谢。你想修改答案以便我给你评分吗
renderPlot({
ggplot(clubSeason, aes_string(x='team', y=input$category)) + geom_boxplot()
})