所以,我在一个月前做了这个侧面项目,但后来因为我感到沮丧而放弃了。 首先,我是新的闪亮和编程所以请,温柔:) 我有数据框,其中我的月份温度为20天,列数表示月份。这部分还可以,网来的东西让我很沮丧。这是代码:
#mornings are column in dataframe that makes sure each month is excatly 20 measurements
Months <- c("J", "F", "Mar", "A", "May", "Jun", "Jul", "A", "S", "O", "N", "D")
library(ggplot2)
library(shiny)
ui <- fluidPage(
titlePanel("Temperatures"),
sidebarLayout(
sidebarPanel(
selectInput(inputId="day", label="DAY?", choices = Months)
),
mainPanel(
plotOutput("plot")
)
)
)
server <- function(input, output) {
formulaText <- reactive({
paste("Temperature: ", input$temp)
})
output$plot <- renderPlot({
ggplot(data = rates) + geom_line(mapping = aes(x = mornings, y = input$temp))
})
}
shinyApp(ui, server)
答案 0 :(得分:1)
输入列表中的对象采用inputId中的名称,因此将来自Mike的注释与您的注释相结合,尝试将服务器代码更改为:
server <- function(input, output) {
formulaText <- reactive({
paste("Temperature: ", input$day)
})
output$plot <- renderPlot({
ggplot(data = rates) + geom_line(mapping = aes_string(x = "mornings", y = input$day))
})
}