0
我想在Shiny中構建我的第一個應用程序。 我只想選擇一個變量的名稱,以便每次繪製一個變量,但每次我嘗試將變量傳遞給繪圖函數時,我都會收到一個xlim錯誤或「嘗試應用非函數」我的代碼在下面...非常感謝你!!R閃亮 - 簡單的反應問題
UI.R
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Hello Shiny!"),
sidebarPanel(
selectInput(
"variable","The value to change below",
list("Cylinders"="cyl",
"Transmission"="am"))
),
mainPanel(
plotOutput("linePlot")
)
))
server.R
library(shiny)
library(datasets)
shinyServer(function(input, output) {
abc<-reactive({
abc<-mtcars$input$variable
})
output$linePlot<-renderPlot({
plot(abc(),type='l')
})
})
或'mtcars [[input $ variable]]' –