Dear Community: I am running Projection.raster on my species, and got one simple error that I had no idea why. My running code is simply like this:
library(BIOMOD)
setwd("F:/QTP_Layer/model_run/allpresence")
load(paste(getwd(),"/BIOMOD_run.RData",sep=""))
qtp_all<-brick("F:/QTP_Layer/data/qtp_all")
qtp_sel<-stack(qtp_all[[1]],qtp_all[[4]],qtp_all[[15]],qtp_all[[18]],qtp_all[[20]]) ### selected variables
layerNames(qtp_sel)<-Biomod.material$VarNames
Sp.env.sel<-qtp_sel
Projection.raster(RasterProj=Sp.env.sel,Proj.name='qtp.proj',
GLM = T, GBM = T, GAM = T, CTA = F, ANN = F, SRE = F, quant=0.025, FDA =F, MARS = F, RF = T, BinRoc=F, BinKappa=F, BinTSS=T, FiltRoc=F, FiltKappa=F, FiltTSS=T, repetition.models=T,stack.out=TRUE)
# Here is my raster stack input information: class : RasterStack dimensions : 1800, 4200, 5 (nrow, ncol, nlayers) resolution : 0.008333333, 0.008333333 (x, y) extent : 70, 105, 25, 40 (xmin, xmax, ymin, ymax) projection : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 min values : -227 4125 33 11 83 max values : 242 11533 156 2510 8469 #and the error is simply: Error in x at layers[[i]] : subscript out of bounds When traced the error back, I found that I am able to generate the projection for each "g" (algorithm), but then came the error: pile.proj <- stack(pile.proj, run.name2 = g) #where pile.proj is a NULL stack, and g is the projection result. Could anybody explain why? Thanks in advance~ Sincerely Marco
------------------------------------------------------- Ph.D candidate, Chinese Ecological Research Network, Institute of Geographical Sciences and Natural Resources Research, ?Chinese Academy of Sciences, 100101, Beijing Tel: (86)-10-6488 9809