Possible Duplicate:
Drop Columns R Data frame
I know that I can set a column to NULL (i.e. data$todrop = NULL ), but is there a more concise way to subset a data.frame or matrix to all columns but one?  I use the following pattern:
data[ , !colnames( data ) %in% "todrop" ]
this doesn't seem to work:
data[ , -"todrop" ]
note that I do not know the index of column "todrop" a-priori
 
    