Я делаю блестящее приложение R, но я столкнулся со следующей проблемой: при запуске приложения отображается сообщение об ошибке:
Предупреждение: ошибка в $: объект типа 'закрытие 'не является подмножеством 75: single
Я провел исследование и увидел, что это может быть связано с проблемой скобок, но я не вижу, где.
Вот мой код:
shinyServer(function(input, output) {
## Table DATA
output$table.pop <-renderDataTable(
data,
server=T,
options=list(dom= 'tp', #table + pagination
pageLength = 25 ,
orderClasses=T
)
)
## Graphique Stat Global
output$distPlot <- renderPlot({
x <- data$age
bins <- seq(min(x), max(x), length.out = 5)
hist(x, breaks = bins, col = '#FF6600', border = 'white',main ="Répartition de l'âge ")
})
output$barplot <- renderPlot({
x <- table(data$Catlib)
barplot(x,col ="purple",border = "white",main="Effectif par catégorie",las=2)
})
## Graphique par sport
output$distPlot1 <- renderPlot({
data <- data[data$FedNom == input$select,]
x <- data$age
bins <- seq(min(x), max(x), length.out = 5)
hist(x, breaks = bins, col = '#FF6600', border = 'white',main ="Répartition de l'âge")
})
output$barplot1 <- renderPlot({
data <- data[data$FedNom == input$select,]
x <- table(data$Catlib)
barplot(x,col ="purple",border = "white",main="Effectif par catégorie",las=2)
})
## Carte
output$mymap <- renderLeaflet({
leaflet() %>%
addProviderTiles(providers$Stamen.TonerLite,
options = providerTileOptions(noWrap = TRUE)
) %>%
addCircleMarkers(
lng = data1$Longitude,
lat = data1$Longitude,
radius = data1$NB, weight = 0.25,
stroke = T, opacity = 100,
fill = T, fillColor = "#920000",
fillOpacity = 100,
popup = ctry$label,
color = "red")
})
})
shinyUI(fluidPage(
dashboardPage(
dashboardHeader(title="Sportifs de haut niveau en 2015"),
dashboardSidebar(
sidebarMenu(
menuItem("Table", tabName = "table",icon = icon("table")),
menuItem("Statistique Descriptive", tabName = "plot"),
menuItem("Carte",tabName = "carte")
)
),
dashboardBody(
tabItems(
## Feuille data
tabItem(tabName="table",
h3("Table"),
DT::dataTableOutput("table.pop")
),
## Feuille Stats desc
tabItem(tabName="plot",
fluidRow(
h3("Statistique Descriptives Global")),br(),
fluidRow(column(6,
box(plotOutput("distPlot", height = 500))),
column(6,
box(plotOutput("barplot", height = 500)))),
fluidRow(
h3("Statistique Descriptives par sport")),br(),
fluidRow(
selectInput("select",label = h3("Selectionnez le sport de votre choix"), choices = unique(data$FedNom), selected= unique(data$FedNom)[1])),br(),
fluidRow(column(6,
box(plotOutput("distPlot1", height = "500px"))),
column(6,
box(plotOutput("barplot1", height = "500px"))))
),
### Carte
tabItem(tabName="carte",
leafletOutput("mymap")
)
)
)
)
))