闪亮的仪表板发布问题“检查您的日志或与应用程序作者联系以进行澄清。”

时间:2019-02-16 06:58:35

标签: r shiny shinydashboard shiny-server

我一直试图在shinnyapps.io服务器上发布闪亮的仪表板应用程序。但是,即使该应用程序在本地运行,我似乎也无法在网上发布该应用程序取得任何成功。它给了我这个错误。

错误:发生错误。查看您的日志或与应用作者联系以进行澄清。

我正在运行Windows 10 64位计算机。我尝试更新所有我的R库,这在以下线程中被推荐,但仍然出现相同的错误。

ERROR: An error has occurred. Check your logs or contact the app author for clarification

我的server.r代码在下面

library(shiny)
library(shinydashboard)
library(tidyverse)
library(lubridate)
library(plotly)
library(shinyWidgets)
library(DT)

df <- read.csv("student_data.csv")

df <- df %>%
 mutate(dov = ymd(date_of_visit))

## Value1: Total Schools Covered
tot.school <- df %>% distinct(school) %>% nrow()

## Value2: Total Sudents Present
tot.present <- df %>% filter(student_present == "Present") %>% count()

## Value3: Total Enrolment
tot.enrolment <- df %>% filter(currently_enrolled != "No: Dropped out" & currently_enrolled != "") %>% nrow()

## Value4: Photo Mismatch  
photo.mismatch <- df %>% filter(verified_by_photo == "Mismatched photo") %>% count()

## Value5: Average enrolment by cohort C
avg.enrol <- df %>%
  filter(currently_enrolled != "No: Dropped out" & currently_enrolled != "") %>%
  group_by(school) %>%
  mutate(schl_enrol = n()) %>%
  group_by(cohort) %>%
  summarise(mean = mean(schl_enrol))

avg.enrol.C <- pull(subset(avg.enrol, cohort == "C")[,2])

## Value6: Average enrolment by cohort D
avg.enrol.D <- pull(subset(avg.enrol, cohort == "D")[,2])

############ ------------------------------------------ ############
shinyServer(function(input,output){

## Value1: Total Schools Covered ## 
  output$value1 <- renderValueBox({
    valueBox(
      formatC(tot.school, format="d", big.mark=','),
      paste('Total Schools :',tot.school),
      icon = icon("school",lib='font-awesome'),
      color = "purple") 
  })

## Value2: Total Sudents Present ##
  output$value2 <- renderValueBox({
    valueBox(
      formatC(tot.present$n[1], format="d", big.mark=','),
      paste('Total Present Students :',tot.present$n[1]),
      icon = icon("user-graduate",lib='font-awesome'),
      color = "green") 
  })

## Value3: Total Enrolment ##
  output$value3 <- renderValueBox({
    valueBox(
      formatC(tot.enrolment, format="d", big.mark=','),
      paste('Total Enrolled Students :',tot.enrolment),
      icon = icon("graduation-cap",lib='font-awesome'),
      color = "yellow")
  })

## Value4: Total Photo Mismatches ##  
  output$value4 <- renderValueBox({
    valueBox(
      formatC(photo.mismatch$n[1], format="d", big.mark=','),
      paste('Total Photo Mismatches :',photo.mismatch$n[1]),
      icon = icon("camera-retro",lib='font-awesome'),
      color = "purple")
  })

## Value5: Average enrolment in Cohort C ##
  output$value5 <- renderValueBox({
    valueBox(
      formatC(avg.enrol.C, big.mark=','),
      paste('Average Enrolment in Cohort C :', round(avg.enrol.C,2)),
      icon = icon("graduation-cap",lib='font-awesome'),
      color = "green")
  })

## Value6: Average enrolment in Cohort D ##
  output$value6 <- renderValueBox({
    valueBox(
      formatC(avg.enrol.D, big.mark=','),
      paste('Average Enrolment in Cohort D :', round(avg.enrol.D, 2)),
      icon = icon("address-card",lib='font-awesome'),
      color = "yellow")
  })

  output$histogram <- renderPlotly({
      p <- df %>%
          filter(district == input$dist & (cohort == "C" | cohort == "D")) %>%
          ggplot() + geom_bar(aes(dov)) + facet_wrap(~ cohort, nrow = 1)
      print(p)

  })

  output$mismatch <- renderPlotly({

    p1 <- df %>%
      filter(verified_by_photo != "") %>%
      ggplot() + geom_bar(aes(district, fill = verified_by_photo), position = "dodge")
    print(p1)
  })

  output$absent <- renderPlotly({

    p2 <- df %>%
      filter(student_present != "") %>%
      ggplot() + geom_bar(aes(district, fill = student_present), position = "dodge")
    print(p2)
  })

  output$etable <- DT::renderDataTable({
    df %>%
      group_by(district) %>%
      summarise(
        Minimum  = min(school),
        Maxmimum = max(school),
        Mean     = mean(school)
      )
  })
}
)

我的ui.r低于

library(shiny)
library(shinydashboard)
library(tidyverse)
library(lubridate)
library(plotly)
library(shinyWidgets)
library(DT)

shinyUI(
  dashboardPage(
    dashboardHeader(title = "SENSA Dashboard",
                    tags$li(a(img(src = 'logo.jpg',
                                  title = "Company Home", height = "30px"),
                              style = "padding-top:10px; padding-bottom:10px;"),
                            class = "dropdown")),

    dashboardSidebar(
      # sliderInput("bins","Number of Breaks",1,100,50),
      # selectInput("dist",
      #             shiny::HTML("<p><span style='color: black'>Names of District </span></p>"),
      #             choices = c("Select District", levels(df$DISTRICT))),
      pickerInput("dist",
                  shiny::HTML("<p><span style='color: black'>Names of District </span></p>"),
                  choices=levels(df$district),
                  options = list(`actions-box` = TRUE),multiple = T,
                  selected = levels(df$district)),
      sidebarMenu(
      menuItem("Main Dashboard", tabName = "main",
               icon = icon("tachometer")),
      menuItem("Student Information", tabName = "student",
               icon = icon("user-graduate")),
      menuItem("Enumerators Information", tabName = "enum",
               icon = icon("chalkboard-teacher"))
    )),
    dashboardBody(
      tags$head(tags$style(HTML('
                                /* logo */
                                .skin-blue .main-header .logo {
                                background-color: #002147;
                                }

                                /* navbar (rest of the header) */
                                .skin-blue .main-header .navbar {
                                background-color: #002147;
                                }
                                /* body */
                                .content-wrapper, .right-side {
                                background-color: #ffffff;
                                }

                                /* main sidebar */
                                .skin-blue .main-sidebar {
                                background-color: #A6A6A6;
                                }

                                /* other links in the sidebarmenu */
                                .skin-blue .main-sidebar a{
                                background-color: #A6A6A6;
                                color: #000000;
                                font-weight: bold;
                                }

                                /* Hovered side bar*/
                                .skin-blue .main-sidebar .sidebar .sidebar-menu a:hover{
                                background-color: #002147;
                                }

                                /* Active sidebar */
                                .skin-blue .main-sidebar .sidebar .sidebar-menu .active a{
                                background-color: #002147;
                                color: #ffffff;
                                }
                                '))),
      tabItems(
        tabItem(tabName = "main",
                ##########################
                # First row with numbers #
                ##########################
                fluidRow(
                  valueBoxOutput("value1"),
                  valueBoxOutput("value2"),
                  valueBoxOutput("value3")
                ),
                ##########################
                # Second row with graphs #
                ##########################
                fluidRow(
                  column(12,
                         plotlyOutput("histogram"))
                )
                ),
        tabItem(tabName = "student",
                ##########################
                # First row with numbers #
                ##########################
                fluidRow(
                  valueBoxOutput("value4"),
                  valueBoxOutput("value5"),
                  valueBoxOutput("value6")
                ),
                ##########################
                # Second row with graphs #
                ##########################
                fluidRow(
                  column(6,
                         plotlyOutput("mismatch")),
                  column(6,
                         plotlyOutput("absent"))
                )
        ),
        tabItem(tabName = "enum",
                h1("Enumerators Information"),
                fluidRow(
                  column(6,DT::dataTableOutput("etable"))
                )
                   )
      )

  )
  )
)

来自服务器的日志在下面。

2019-02-15T19:43:15.866870+00:00 shinyapps[718614]: The following objects 
are masked from ‘package:shiny’:
2019-02-15T19:43:15.866871+00:00 shinyapps[718614]: 
2019-02-15T19:43:15.866872+00:00 shinyapps[718614]:     dataTableOutput, 
renderDataTable
2019-02-16T06:45:22.250693+00:00 shinyapps[718614]: Server version: 1.7.0- 
11
2019-02-16T06:45:22.250732+00:00 shinyapps[718614]: LANG: en_GB.UTF-8
2019-02-16T06:45:22.415359+00:00 shinyapps[718614]: Using jsonlite for JSON 
processing
2019-02-16T06:45:22.250733+00:00 shinyapps[718614]: R version: 3.5.2
2019-02-16T06:45:22.420787+00:00 shinyapps[718614]: 
2019-02-16T06:45:22.250740+00:00 shinyapps[718614]: shiny version: 1.2.0
2019-02-16T06:45:22.250741+00:00 shinyapps[718614]: httpuv version: 1.4.5.1
2019-02-16T06:45:22.250760+00:00 shinyapps[718614]: rmarkdown version: 1.11
2019-02-16T06:45:22.251028+00:00 shinyapps[718614]: Using pandoc at 
/opt/connect/ext/pandoc2
2019-02-16T06:45:22.250824+00:00 shinyapps[718614]: htmltools version: 
0.3.6
2019-02-16T06:45:22.250796+00:00 shinyapps[718614]: RJSONIO version: NA
2019-02-16T06:45:22.250777+00:00 shinyapps[718614]: jsonlite version: 1.6
2019-02-16T06:45:22.250771+00:00 shinyapps[718614]: knitr version: 1.21
2019-02-16T06:45:22.420788+00:00 shinyapps[718614]: Starting R with process 
ID: '17'
2019-02-16T06:45:22.450633+00:00 shinyapps[718614]: 
2019-02-16T06:45:22.450635+00:00 shinyapps[718614]: Listening on 
http://127.0.0.1:36786
2019-02-16T06:45:28.928915+00:00 shinyapps[718614]: 
2019-02-16T06:45:28.928918+00:00 shinyapps[718614]: Attaching package: 
‘shinydashboard’
2019-02-16T06:45:28.928920+00:00 shinyapps[718614]: 
2019-02-16T06:45:28.929819+00:00 shinyapps[718614]:     box
2019-02-16T06:45:28.929817+00:00 shinyapps[718614]: The following object is 
masked from ‘package:graphics’:
2019-02-16T06:45:28.929819+00:00 shinyapps[718614]: 
2019-02-16T06:45:28.935034+00:00 shinyapps[718614]: Loading required 
package: ggplot2
2019-02-16T06:45:28.929820+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.362943+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.362946+00:00 shinyapps[718614]: Attaching package: 
‘plotly’
2019-02-16T06:45:29.362948+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.363423+00:00 shinyapps[718614]: The following object is 
masked from ‘package:ggplot2’:
2019-02-16T06:45:29.363424+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.363424+00:00 shinyapps[718614]:     last_plot
2019-02-16T06:45:29.363425+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.364255+00:00 shinyapps[718614]: The following object is 
masked from ‘package:stats’:
2019-02-16T06:45:29.364257+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.364257+00:00 shinyapps[718614]:     filter
2019-02-16T06:45:29.364258+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.364986+00:00 shinyapps[718614]: The following object is 
masked from ‘package:graphics’:
2019-02-16T06:45:29.364987+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.364987+00:00 shinyapps[718614]:     layout
2019-02-16T06:45:29.364988+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.379718+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.379721+00:00 shinyapps[718614]: Attaching package: 
‘DT’
2019-02-16T06:45:29.379722+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.380202+00:00 shinyapps[718614]: The following objects 
are masked from ‘package:shiny’:
2019-02-16T06:45:29.380203+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.380204+00:00 shinyapps[718614]:     dataTableOutput, 
renderDataTable
2019-02-16T06:45:29.380204+00:00 shinyapps[718614]: 
2019-02-16T06:45:29.413329+00:00 shinyapps[718614]: Warning: Error in $: 
object of type 'closure' is not subsettable
2019-02-16T06:45:29.417657+00:00 shinyapps[718614]:   71: levels

请提出解决方案。

谢谢

0 个答案:

没有答案