Hi I'm getting this error, I was wondering if anyone could help. (error occurs when last line is run).
Error in xy[, 3] : incorrect number of dimensions
The cinq.us.sp was original a csv made into a sp object.
I’ve tried cinq.us.sp.cc <- st_transform(cinq.us.sp, tempcrs) I get Error in UseMethod("st_transform") :
no applicable method for 'st_transform' applied to an object of class "data.frame"
Is there a way in figuring out what dimensions I should be using?
Any help is greatly appreciated. Thank you.
make a raster grid and set its resolution & widen its extent
r <- raster(cinq.us.sp)
res(r) <- 0.01
r <- extend(r, extent(r)+1)
p.dat.s <- SpatialPointsDataFrame(p.dat[1:2], p.dat[3:7])
crs(p.dat.s) <- CRS('+proj=longlat +datum=WGS84')
p.dat.s <- spTransform(p.dat.s, newcrs)
take a sample of the points
pres.dat <- data.frame(gridSample(p.dat.s, r, 1))