Hi,
I have a test app that read a csv file and plot the distribution. The app works well on local machine but have some error "cannot open the connection" when deploy to
shinyapps.io. Please see my ui.R and server.R below.
ui.R:
library(shinydashboard)
header <- dashboardHeader()
sidebar <- dashboardSidebar(
sidebarMenu(
menuItem("Dashboard", tabName = "tab1"),
selectInput("index",
label = "Choose one to forecast:",
choices = list("Dow Jones"= "DJI",
"Russell 1000" = "RUI"
),
selected = "DJI"
)
)
)
body <- dashboardBody(
tabItem(tabName = "tab1",plotOutput("plot"))
)
ui <- dashboardPage(
header,
sidebar,
body
)
server.R:
library(shinydashboard)
server <- function(input, output) {
dataInput <- reactive({
ind <- input$index
imp <- read.csv(paste(ind,'_featureimp.csv',sep = ""))
return(list(imp=imp,ind=ind))
})
output$plot <- renderPlot({
imp <- dataInput()$imp
hist(imp$importance)
}
)
}
I guess the problem is I pass a variable when reading the csv file. Can anyone think any solution to it?
Thanks,
Joy