hi all,
I am new to using ShinyIO server.
I did the steps mentioned in the ShinyIO documentation, tried deploying a simple shiny app and it was deployed successfully.
However, I am now trying to deploy a Shiny app which was running successfully on the local environment.
Steps tried -
install.packages("rcpp")
and then republished still getting the same error.
Error in value[3L] : could not find function "dashboardPage"
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
Execution halted
Attached is the code from App.R -
df<- read.csv('PRICEDATA.csv')
colnames(df)[1]<-'dates'
df <- data.frame(df)
ui <- dashboardPage(
dashboardHeader(title = "DataScienceLab",titleWidth = 400),
dashboardSidebar(width = 400,
sidebarMenu(
selectInput(inputId = "Region", label = "Select Region:",
choices = unique(df$regionName)),
selectInput(inputId = "ProductLine", label = "Select Product Line:",
choices = NULL),
checkboxGroupInput(inputId = "PRODUCT", label = "Products",
choices = NULL),
selectInput(inputId = "DATE1", label = "From Date:",
choices = NULL),
selectInput(inputId = "DATE2", label = "To Date:",
choices = NULL),
actionButton(inputId = "button", label = "Display"))
),
dashboardBody(
fluidRow(useShinyjs(),
tabBox(width = 12, height = 500,
tabPanel("Insights",
fluidRow(
box(title = "Results",height= 400, width=12,status = "primary",solidHeader = T, div(DT::dataTableOutput("table"), style = "font-size: 100%; width: 100%"))
),
fluidRow(
box(title = "Description",height=100, width=12,
hidden(
div(id='up',tags$script(src = "https://kit.fontawesome.com/a076d05399.js"), tags$i(class='fa fa-arrow-circle-up', style='font-size:36px'),tags$b(" trend in sales",style='font-size:30px')),
div(id='down',tags$script(src = "https://kit.fontawesome.com/a076d05399.js"), tags$i(class='fa fa-arrow-circle-down', style='font-size:36px'),tags$b(" trend in sales",style='font-size:30px'))
)
)
)
),
tabPanel("Visualization",
fluidRow(
box(title = "Bar Chart",height= 500, width=6,status = "primary",solidHeader = T,plotOutput("bar")),
box(title = "Pie Chart",height=500, width=6,status = "primary",solidHeader = T,plotOutput("pie1"))
),
),
tabPanel("Forecasting",
fluidRow(
box(title = "Forecast for Region1",height= 500, width=12,status = "primary",solidHeader = T,plotOutput("fusa"))
),
fluidRow(
box(title = "Forecast for Region2",height= 500, width=12,status = "primary",solidHeader = T,plotOutput("fmexico"))
),
fluidRow(
box(title = "Forecast for Region3",height= 500, width=12,status = "primary",solidHeader = T,plotOutput("fcanada"))
)
)
)
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output, session) {
observeEvent(input$Region,{
updateSelectInput(session,'ProductLine',
choices=unique(df$productLine[df$regionName==input$Region]))
})
observeEvent(input$ProductLine,{
updateCheckboxGroupInput(session,'PRODUCT',
choices=unique(df$productName[df$regionName==input$Region & df$productLine==input$ProductLine]))
})
observeEvent(input$PRODUCT,{
dateList = unique(df$dates[df$productName==input$PRODUCT])
updateSelectInput(session,'DATE1',choices=dateList)
updateSelectInput(session,'DATE2',choices=dateList)
})
Forecast <- function(region, productLine, product, date1,date2){
setwd('C:/R/Apps/PriceDataApp')
df<- read.csv('PRICEDATA.csv')
colnames(df)[1]<-'dates'
str(df)
df<-subset(df,select = -c(4:22))
df<-subset(df,select = -c(7:9))
df1 <- subset(df, (regionName == region) & (productLine == productLine))
nrow(df1)
df1 <- df1[df1$productName %in% product,]
dfDate1 <- subset(df1,(dates == date1 ))
dfDate2 <- subset(df1,(dates == date2 ))
df1 <- rbind(dfDate1, dfDate2)
dfFinal <- aggregate(sale~.,data=df1,FUN=sum)
dfFinal <-dfFinal[,-c(2:4)]
return(dfFinal)
}
observeEvent(input$button, {
region<- input$Region
productLine<- input$ProductLine
product<- input$PRODUCT
date1 <- input$DATE1
date2 <- input$DATE2
b <- Forecast(region, productLine, product,date1,date2)
dftransposed <- tidyr::spread(b, dates, sale)
output$table <- DT::renderDataTable(
datatable(dftransposed, rownames= FALSE,options = list(searching = FALSE,bPaginate= FALSE,lengthChange = FALSE,info = FALSE,pageLength = 20, scrollX = T))
)
prev<- sum(dftransposed[2])
current <- sum(dftransposed[3])
print(current)
if (prev<current){
print('Increase')
show('up')
hide('down')
}else if(prev>current){
print('Decrease')
show('down')
hide('up')
}
output$bar <- renderPlot({
stackbarplot1<- ggplot() + geom_bar(aes(x=b$dates,y=b$sale,fill=b$productName), data=b,
stat = "identity")+
scale_fill_viridis(discrete = T) +
ggtitle("Sales distribution across dates") +
theme_ipsum() +
theme(axis.text.y = element_blank(),axis.title.y = element_blank(),
axis.title.x = element_blank(),
plot.title = element_text(size = 20, face = "bold",color="black"),
legend.title = element_blank())
stackbarplot1
})
output$pie1 <- renderPlot({
pieChartPlot1<-ggplot(b, aes(x="", y=b$sale, fill=b$productName)) +
geom_bar(stat="identity", width=1) +
coord_polar("y", start=0)+
scale_fill_viridis(discrete = T) +
ggtitle("Productwise Distribution of sales") +
theme_ipsum_ps()+
xlab("")+
ylab("")+
theme(axis.text.x = element_blank(),
plot.title = element_text(size = 20, face = "bold",color="black"),
legend.title = element_blank())
pieChartPlot1
})
})
}
# Run the application
shinyApp(ui = ui, server = server)