[R-sig-Geo] for loop for raster class

Vikram Ranga babuawara at gmail.com
Thu Jan 12 12:50:17 CET 2012


Hi,
I am trying to crop images using raster library it works fine but when i 
put that on loop it does not work
my syntax is
febb3<-raster("C:/landsat/New 
Landsat/February/L5146041_04120110201_B30.tif")
febb4<-raster("C:/landsat/New 
Landsat/February/L5146041_04120110201_B40.tif")
.
.
.
.
so on
msk<-raster("C:/landsat/mask.tif")
ls.im<-c(x1=janb3,x2=janb4,x3=febb3,x4=febb4,x5=octb3,x6=octb4,x7=novb3,x8=novb4,x9=decb3,x10=decb4)
ls.em<-c(1:10)
#for loop
for (i in 1:1){ls.em<-crop(ls.im[i],msk)}
error
Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function "crop", for signature 
"list"
I think there is a problem with the c or list function for concatenating 
all the images. I tried few things but no luck.
Any help would be highly appreciated.

Regards,
Vikram.



More information about the R-sig-Geo mailing list