[R-sig-Geo] subs and the name of column
Alfredo Alessandrini
alfreale74 at gmail.com
Mon Jul 18 16:34:12 CEST 2011
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 : 0.008333333, 0.008333333 (x, y)
extent : 99.48333, 100.0333, 2.275, 2.733333 (xmin, xmax, ymin, ymax)
projection : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0
values : in memory
min value : -0.03073237
max value : -0.02022671
> subs(raster_cluster,data_6SV_cluster,by=1,which=2)
class : RasterLayer
dimensions : 55, 66, 3630 (nrow, ncol, ncell)
resolution : 0.008333333, 0.008333333 (x, y)
extent : 99.48333, 100.0333, 2.275, 2.733333 (xmin, xmax, ymin, ymax)
projection : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0
values : in memory
min value : -0.03073237
max value : -0.02022671
> colnames(data_6SV_cluster)
[1] "cluster" "intercept" "coefficient"
> subs(raster_cluster,data_6SV_cluster,by="cluster",which=2)
Error in `[.data.frame`(y, , c(by, which)) : undefined columns selected
More information about the R-sig-Geo
mailing list