I\'m creating a simple line chart which renders correctly in Shiny.
I\'ve now added a selectInput with the names of 2 different measures, written as they appear in m
Use base::get() function:
p <- plot_ly(data = data, x = ~Month, y = ~get(input$Measure), type = "line")
or the same using ggplot:
p <- ggplot(data = data, aes(x = Month, y = get(input$Measure))) +
geom_line(size = 1.5) +
theme_minimal()
ggplotly(p)
Simply just use data[ ,input$Measure]
as Your y variable:
p <- plot_ly(data = data, x= Month, y = data[ ,input$Measure], type = "line")