0

I'm trying to create random points using slpancs library in R. But I have this problem:

random_points<- csr(poly = "zona", 1000) Error in poly[, 1] : incorrect number of dimensions

0

The poly argument has to be a two-dimensional matrix with two columns, defining the polygon. Since you've passed a string "zona", the function has told you this isn't usable.

2
  • But "zona" is a polygon in a shapefile which I did in QGIS and import to R Apr 16 at 16:56
  • You passed a string in quotation marks. poly="zona". If you have an object called zona then you don't put it in quotes, you do poly=zona. But read the help for csr because it only works if poly is a two-column matrix - it does not work for complex spatial objects and classes like sf.
    – Spacedman
    Apr 16 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.