ggplot2 - using R shiny server together with ggplot -


am using ggplot plot pie chart in code below in rstudio , working fine. problem when want use r shiny server.

indicatortotals<-tapply(anc_data$total,anc_data$indicator,sum) graphdatapie <- as.data.frame(indicatortotals) c <- ggplot(graphdatapie, aes(x=rownames(graphdatapie),y=indicatortotals,fill =      indicatortotals)) + geom_bar(width = 1,stat="identity") print(c + coord_polar(theta = "y")) 

the data format

                       indicatortotals anc 1st visit                   248777 anc 2nd visit                   231914 anc 3rd visit                   162062 anc 4th or more visits           99528 

i following error message r shiny server ui.r.

error:object 'graphdatapie' not found.  

what problem???

add following ggplot function: environment=environment() i.e

ggplot(graphdatapie, aes(x=rownames(graphdatapie),y=indicatortotals,fill =               indicatortotals), environment=environment())  

then restart shiny-server. solve problem.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -