[R-sig-Geo] Error in basename(x) : path too long

John Wasige johnwasige at gmail.com
Sat Jul 29 13:56:27 CEST 2017


​Dear all,

I am running the script below & I get the following error:
Error in basename(x) : path too long
​
What could be the problem?
Thanks for your help
John

​### Script​

setwd("I:/Mauritius2001_2015")  # directory of data
newlist= read.csv('I:/Mauritius2001_2015/Mauritius.csv',header=F)

refr <- raster(paste("I:/Mauritius2001_2015/",newlist[i,1],sep = ""))
refr[!is.na(refr)] <- 0
for(i in seq(1,345,by=23)){
  rsum <- refr
  for(p in 0:22){
    r <- raster(paste("I:/Mauritius2001_2015/",newlist[i+p],sep = ""))
    rsum <- rsum + r
  }
  #   rsum <- rsum
  writeRaster(rsum,
filename=paste("D:/Mauritius2001_2015/Annual/",substr(newlist[i],1,6),".tif",sep=''),
format="GTiff", overwrite=TRUE)
}

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list