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

Robert Hijmans r.hijmans at gmail.com
Tue Jul 19 04:51:24 CEST 2011


> 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: 

>> 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 

Alfredo, 

Currently, the columns should be either indicated by their position (a
number) or by their name; but you cannot mix the two. These alternatives
should work:

subs(raster_cluster,data_6SV_cluster,by="cluster",which="intercept") 

subs(raster_cluster,data_6SV_cluster,by=1,which=2) # the default

Robert

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/subs-and-the-name-of-column-tp6594997p6597311.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list