收到錯誤:
output object not found
不知道爲什麼會這樣,我已經做了過去的儀表盤同樣的東西那個時候沒有出現錯誤。 輸出對象指定,但它仍然不能檢測
Server.R
d <-read_excel("data/ds.xlsx",sheet = 1)
output$plot1 <- renderPlotly({
data <- switch(input$var,
"Beginning Stocks (1000 MT)"= d$`Beginning Stocks (1000 MT)`
,"Area Harvested (1000 HA)" = d$`Area Harvested (1000 HA)`
,"Yield (MT/HA)" = d$`Yield (MT/HA)`
,"Production (1000 MT)" = d$`Production (1000 MT)`
,"MY Imports (1000 MT)" =d$`MY Imports (1000 MT)`
)
data1 <- switch(input$var1,
"Beginning Stocks (1000 MT)"= d$`Beginning Stocks (1000
MT)`
,"Area Harvested (1000 HA)" = d$`Area Harvested (1000 HA)`
,"Yield (MT/HA)" = d$`Yield (MT/HA)`
,"Production (1000 MT)" = d$`Production (1000 MT)`
,"MY Imports (1000 MT)" =d$`MY Imports (1000 MT)`
)
plot_ly(d, x =~d$`Attributes (Unit)`, y = ~data,type= "scatter",mode =
'markers+lines', marker = list(size = 10),name=input$var) %>%
add_trace(x = ~d$`Attributes (Unit)`, y = ~data1,type="scatter"
,mode="markers+lines",name=input$var1)
})
UI.R
navbarPage("Barley Dashboard",
tabPanel("Balance sheet",
fluidPage(theme = shinytheme("united"),
mainPanel(fluidRow(column(8,selectInput("var",selected="select",
label = "Choose first variable",
choices = c("Beginning Stocks (1000 MT)","Area Harvested (1000
HA)","Yield (MT/HA)","Production (1000 MT)","MY Imports (1000
MT)")
)
),
column(8,selectInput("var1", selected = "select",
label = "Choose second variable",choices = c("Beginning Stocks
(1000 MT)", "Area Harvested (1000 HA)","Yield (MT/HA)","Production
(1000 MT)","MY Imports (1000 MT)")
)
)
),
plotlyOutput("plot1")
))))
收到錯誤:Error in output$plot1 <- renderPlotly({ : object 'output' not found
我不是能夠糾正錯誤
你有'服務器< - 功能(輸入,輸出,會話){' – akrun
@akrun沒有我創建單獨的標籤爲UI和服務器,所以不包括這 –
那麼我該如何解決這個問題? –