incorrect number of dimensions

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.

R script:

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)

head(p.dat)

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))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.