Dear Members, I'll calculate some old codes for a paper review, and I'm astonished that as.im() for fitting the Poisson model is not working as before. In my example:
library(raster) library(spatstat) # Elevation r.grid.world <- raster('https://raw.githubusercontent.com/Leprechault/trash/main/wc2.1_10m_elev.tif') proj4string(r.grid.world) <- CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0") r.grid.world.SGDF.F <- as(r.grid.world, "SpatialGridDataFrame") #Fitting Poisson model fit.c <- ppm(nztrees, ~ elev, covariates=list(elev=as.im(r.grid.world.SGDF.F[[1]]))) # # Error in as.im.default(r.grid.world.SGDF.F[[1]]) : # Can't convert X to a pixel image I tried as matrix and rotate, and the final real-valued pixel image didn't work as a covariate in the model. Please, any help with it? Thanks in advance Alexandre _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo