[R-sig-Geo] crop by pixel

2011-07-26 Thread Alfredo Alessandrini
Hi, I need to crop a raster by pixel value, from upper X,Y left. I'm using this: spot - raster(.) x_shift - 2 y_shift - 2 crop(spot,extent(xmin(spot)+res(spot)[1]*x_shift,xmax(spot),ymin(spot),ymax(spot)-res(spot)[2]*y_shift)) It's work, but is there another way? Thanks,

[R-sig-Geo] subs and the name of column

2011-07-18 Thread Alfredo Alessandrini
Hi to all, I'm trying to use subs function, but I've an error when I use by= with the name of the column. But if I use the column number it work: subs(raster_cluster,data_6SV_cluster,by=1,which=2) class : RasterLayer dimensions : 55, 66, 3630 (nrow, ncol, ncell) resolution :

[R-sig-Geo] classify a raster by unique value

2011-07-12 Thread Alfredo Alessandrini
Hi, I've a raster stack with 3 layers. I need to classify it assigning one class to each unique combination of values. unique(as.matrix(data_stack)) layer_1 layer_2 layer_3 [1,] 0.246000 2-0.1 [2,] 0.184500 2-0.1 [3,] 0.01 2-0.1 [4,]

[R-sig-Geo] apply a formula by matrix

2011-07-07 Thread Alfredo Alessandrini
Hi, I've to apply a formula to a raster in relation to an index table created from raster stack. I'm trying to explain the problem: I've three raster with same resolution, that I join in a raster RasterStack, and from it I can obtain a table like this: data - stack(dem,aer550,aer550_type)

[R-sig-Geo] replace NA with closest value

2011-06-07 Thread Alfredo Alessandrini
Hi, I need to write a function to use with calc (raster package) that replace the NA value of the raster with the value closest to it. Any suggestion on how to write it? thanks, Alfredo ___ R-sig-Geo mailing list R-sig-Geo@r-project.org