Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while uploading app in Shiny.io

I'm trying to upload a shiny app on Shiny.io. The app gets deployed and when the link is tried the app gets crashed by throwing an error Disconnected from Server. When I checked in the Logs of the dashboard, it says Error in the server: could not find function "server".

I was not able to find the solution for this. Documents and articles regarding the same shows that the Packages used could be one of the reasons for the error but I'm not able to find the list of packages that will be compatible or not.

These are the list of packages/libraries that are used in my app,

  1. Shiny
  2. Earth
  3. ggplot2
  4. Plot3D
  5. visreg
  6. rgl
  7. zoo
  8. Hmisc
  9. dplyr
  10. shinyBS
  11. shinycssloaders

Thanks in Advance!!

UPDATE

Below are the reproducible ui.R and server.R scripts. Upon debugging I found that this part of the code is error while deploying.

ui.R

library(shiny)
library(shinyBS)
library(shinycssloaders)
options(shiny.trace=TRUE)

shinyUI(pageWithSidebar(



  fluidRow(
   column(width = 4,height = 4,img(src='image.png', align = "left", height = 
   50, width = 200)),
   column(8,titlePanel("Analysis"))
 ),


  sidebarPanel(

  br(),

  fileInput("file1", label = ("  Data "),multiple = F),

  fluidRow(
    column(12,align ="center", actionButton("button", "Analyze",style = 
    "background-color : skyblue", icon = icon("stats", lib = 
     "glyphicon"),width = 250 )))


 ),
 mainPanel(

   bsAlert("alert"),

   br(),

    fluidRow(        

     tabsetPanel(
      tabPanel("Table",icon = 
       icon("table"),withSpinner(dataTableOutput('table'), type = 
       getOption("spinner.type", default = 8) ))

      )
     )
   )
 ))

server.R

  library(shiny)
   library(shiny)
   library(earth)
  library(ggplot2)
   library(plot3D)
  library(visreg)
  library(rgl)
  library(zoo)
  library(Hmisc)
  library(dplyr)
  library(gridExtra)

  options(shiny.maxRequestSize=30*1024^2) 
  options(shiny.trace=TRUE)

  if (interactive()){
    shinyServer(function(input, output,session) {
    dataframe <- reactive( {

    ###  Create a data frame reading data file to be used by other 
    functions..
      inFile <- input$file1     
      data1 <- read.csv(inFile$datapath, header = TRUE)


     })

     table1<- eventReactive(input$button, dataframe())
      output$table <- renderDataTable({table1()})

    })
 }

Thanks!

like image 526
Tareva Avatar asked Oct 31 '17 06:10

Tareva


1 Answers

Finally I was able to debug the code and find a solution for the error.

From Server.R delete the statement if (interactive()) and delete session parameter from the shinyServer(function(input,output,session)).

Hence deployed without any error.

Replace the following server.R script and it should work fine.

 library(shiny)
 library(shiny)
 library(earth)
 library(ggplot2)
 library(plot3D)
 library(visreg)
 library(rgl)
  library(zoo)
 library(Hmisc)
library(dplyr)
library(gridExtra)

options(shiny.maxRequestSize=30*1024^2) 
 options(shiny.trace=TRUE)

shinyServer(function(input, output) {
dataframe <- reactive( {

  ###  Create a data frame reading data file to be used by other functions..
  inFile <- input$file1


  data1 <- read.csv(inFile$datapath, header = TRUE)


   })

   table1<- eventReactive(input$button, dataframe())
   output$table <- renderDataTable({table1()})

  })
like image 97
Tareva Avatar answered Nov 03 '22 23:11

Tareva