I want to create random points within polygons that are stored in a spatial data frame in R.
I tried to use the csr
function of the splancs
package, and the spsample
of the sp
package without success. I typed the following code:
Csr(Greece.map[1, ], 12)
And received:
Error in storage.mode(poly) <- "double" no method for coercing this s4 class to a vector
And sample(Greece.map[1, ], n=12, random)
receiving the following error:
Error in sample.Spatial(as(x, "Spatial"), n_tot * (1 + its * 0.1), type = type, : object random not found.