This question already has an answer here:

I have this line in my code to create dots for a dot-density map. The function I'm misusing is dotsInPolys in the maptools package. I get this error when I run it and I'm not sure what it means. Can anyone help?

`NSWdots <- dotsInPolys(NSW, as.integer(datajoin$pop.10))`

NSW is a shapefile and datajoin$pop.10 is a vector of numbers.

The given error is:

`Error in if (x[i] > 0) { : missing value where TRUE/FALSE needed`