je travaille sur shiny application mais j'avais rencontré un erreur
Warning: Error in $<-.data.frame: le tableau de remplacement a 1 lignes, le tableau remplacé en a 0
[No stack trace available]
quand j'ai cherché sur les tuto ,j'ai trouvé que mon problème sur le réactivité de mon tableau mais j'ai pas compris comment je peux le régler
la partie render plot :
Code : Tout sélectionner
output$plot <- renderPlot({
if (input$userrights=="hopital"){
to_plot <- tbl_moy_sds
}
else if (input$userrights=="service"){
table_moy <-tbl_exh_t_service %>% filter(libelle==input$inSelect) %>% group_by(libelle,jour) %>%
summarise(Moyenne = mean(taux))
table_sd <- tbl_exh_t_service %>% filter(libelle==input$inSelect) %>% group_by(libelle,jour) %>%
summarise(sds=sd(taux))
tbl_service_moy_sds <- merge(table_moy,table_sd, by=c("libelle","jour"))
tbl_service_moy_sds<- na.omit(tbl_service_moy_sds)
to_plot <- tbl_service_moy_sds
}
else if (input$userrights=="uma"){
uma_moyenne <- tbl_exh_t_u %>% filter(libelle==input$inSelect)%>% group_by(jour,libelle) %>%
summarise(Moyenne = mean(taux))
sds_moyenne <- tbl_exh_t_u %>% filter(libelle==input$inSelect) %>% group_by(jour,libelle) %>%
summarise(s = sd(taux))
h <- merge(uma_moyenne,sds_moyenne, by=c("libelle","jour"))
to_plot <- h
}
pp <- ggplot(to_plot, aes(jour)) +
geom_line( aes(x=jour, y=Moyenne,group=1),data=to_plot, color='blue') +
geom_ribbon(aes(ymin=inf, ymax=sup), alpha=0.3)+
ggtitle(paste0("Evolution du taux : ","''",input$inSelect ,"''"))
print(pp)
})
Merci pour vos retour
Cordialement