search for: dfxyz

Displaying 1 result from an estimated 1 matches for "dfxyz".

Did you mean: dfxy
2010 Dec 27
3
Drop column from a data frame
...n of a data frame. The code below attempts to drop a numeric column (which does not work but gives no error or warning) and a factor column (which does not work but gives an error). I would appreciate someone telling me why my code does not work, and suggesting code that will work. Thanks, John rm(dfxyz,dfxz,dfxy) # create the data frame. dfxyz <- data.frame(x=1:10,y=11:20,z=factor(c(rep(0,5),rep(1,5)))) dfxyz names(dfxyz) # try to drop y column # does not work, does not produce error message dfxz <- dfxyz[,-(dfxyz$y)] dfxz # try to drop z column # does not work, produces error message:...