Moumita Das
2009-Jan-06 14:09 UTC
[R] Can't i provide variables for the select clause of the subset function?
Hi guys, Have done something like this:--- #Looping through each set of elements of the correlation cross product combinations and collecting datatsets for those elements for(corr_combs_counter in 1:1) { rowval_corr_combs<-corr_combs[corr_combs_counter,] col1<-rowval_corr_combs[1] # i get the pairs firtst col value like, i1 col2<-rowval_corr_combs[2] # i get the pairs second col value like, i2 #getting each element dataset col1val<-subset(item_category_table, select =",*col1*,") col2val<-subset(item_category_table, select =",*col2*,") col1val_size<-dim(col1val) #col2val_size<-dim(col2val) print(col1val) print(col2val) } *Can't i use variable names as values of "select =" ?if i hardcode the columnames ,it works fine..* I keep getting warnings:-- *Error in `[.data.frame`(x, r, vars, drop = drop) : undefined columns selected * -- Thanks Moumita [[alternative HTML version deleted]]