Extracting Numeric Columns from Data Fram
On Feb 16, 2013, at 12:15 PM, Barry DeCicco <bdecicco2001 at yahoo.com> wrote:
Hello, I've got a data frame with a mix of numeric, integer and factor columns. I'd like to pull out (or just operate only on) the numeric/integer columns. Every thing I've found in searches is about how to subset by rows, or how to operate assuming you have the column names. I'd like to pull by type. Thanks! Barry
Something like the following should work. If your data frame is "DF": NewDF <- DF[, sapply(DF, is.numeric)] Regards, Marc Schwartz