R - Pie, X values must be positive
r
Solution
I don't have access to your data but in my experience the following might help and is definitely worth a try:
pie(table(values$unemployed))
Would love to learn whether this solved your problem!
Problem
I am new to R and drew some testdata about countries in a csv from the web. I am currenty fooling arround with plotting and encountered said error while creating a pie chart of the worlds unemployment. i issued the following: ``` >values <- read.csv("D:\\test\\countrydata.csv") >names(values) [1] "name" "size" "pop" "unemployed" ... >typeof(values$unemployed) "integer" >pie(values$pop) Error in pie(values$unemployed) : 'x' values must be positive >pie(values$pop, na.rm=TRUE) Error in pie(values$unemployed, na.rm=TRUE) : 'x' values must be positive ``` The dataset i want to plot is a set of integers, all of them are positive, 0 (thanks kim) or NA. 0 are not a problem when plotting integers, i tried ``` >pie(as.integer(c(0,1,2,3)) ``` and it worked fine. What am i missing here? Thanks and Regards, BillDoor