I need to select random points in R from a grid I created in ArcGIS. I'm sort of new to this so I'm not familiar with the codes.
I have a Large SpatialPointsDataFrame with 160831 elements (points) named "gridpts". I imported the points with "readOGR"
> names(gridpts)
[1] "gpts" "L_code" "Lake" "Area"
I want to subset the points by "L_code" and then select random points. This is what I have so far:
acr2.pts <- gridpts[gridpts$L_code == "acr2",]
sample.acr2 <- sample(nrow(acr2.grid), 690)
However, this gives me a vector with the gpts and not a subset of the points which is what I want.
Thank you.