I am trying to create a bubble plot in R using the sp package. My data has a lot of missing values ("N/A") and the bubble plot does not seem to like it.
library(sp)
X<-runif(100, min=0, max=1000)
Y<-runif(100, min=0, max=1000)
grade<-c((rnorm(n=50,mean=30, sd=4)), (rep(NA, 50)))
df<-data.frame(X,Y, grade)
coordinates(df)<-~X+Y
bubble(df, "grade", na.rm=TRUE)
When I run this code I am getting an error message "Error in quantile.default(data[, zcol]) : missing values and NaN's not allowed if 'na.rm' is FALSE".
I don't understand because I have said to remove missing values!! I suspect that sp has a slightly different method for dealing with missing values that I have missed