R 发光和ggplot-使组出现故障=反应性
第一篇文章和第一次使用闪亮和ggplot2,所以请容忍我。我无法让ggplot将输入$变量解释为group=选项的值。我在这方面找到了一些指导,但还不能完全发挥作用。我在下面粘贴了我的代码的简化版本,这会产生一个“InputNotFound”错误。有什么办法解决吗 ui.rR 发光和ggplot-使组出现故障=反应性,r,ggplot2,shiny,R,Ggplot2,Shiny,第一篇文章和第一次使用闪亮和ggplot2,所以请容忍我。我无法让ggplot将输入$变量解释为group=选项的值。我在这方面找到了一些指导,但还不能完全发挥作用。我在下面粘贴了我的代码的简化版本,这会产生一个“InputNotFound”错误。有什么办法解决吗 ui.r library(markdown) shinyUI(navbarPage("Shiny: First App", tabPanel("Annual Trends", ver
library(markdown)
shinyUI(navbarPage("Shiny: First App",
tabPanel("Annual Trends",
verticalLayout(
titlePanel("Annual Subscriptions Data"),
selectInput("dim",
label = "Dimension of Interest",
choices = c("location", "package",
"section", "price.level", "no.seats"),
selected = "location"),
plotOutput("plot"),
)
)
)
)
server.R
library(shiny)
library(ggplot2)
subscriptions = read.csv("data/subscriptions.csv")
shinyServer(function(input, output, session) {
output$plot <- renderPlot({
ggplot(subscriptions, aes(x = season)) +
geom_freqpoly(aes(x = season, group=input$dim, colour=input$dim))
})
})
库(闪亮)
图书馆(GG2)
订阅=read.csv(“data/subscriptions.csv”)
shinyServer(功能(输入、输出、会话){
输出$plot尝试使用aes\u string()
而不是aes()
,以便正确计算输入$dim
:
output$plot <- renderPlot({
ggplot(subscriptions, aes(x = season)) +
geom_freqpoly(aes_string(x = "season", group=input$dim, colour=input$dim))
})
output$plot在plotOutput(“plot”)
之后似乎有一个额外的逗号。如果删除额外的逗号后仍然无法使用,您应该发布一些示例数据,以便我们可以帮助您。