Using R brilliant server with ggplot

Am uses ggplot to build a pie chart, as in the code below in RStudio and its operation. The problem is when I want to use the R brilliant 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")) 

data is a format

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

I get the following error message from R brilliant ui.R server.

 Error:object 'graphdatapie' not found. 

What could be the problem???

+1
source share
1 answer

Add the following to the ggplot function: environment = environment () i.e.

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

Then restart the brilliant server. This will solve the problem.

+2
source

Source: https://habr.com/ru/post/948699/


All Articles