Hi, I was able to replicate the solution as suggested by William in case of data.frame class, not in case of data.table class. In case of data.table, I had to do some minor changes as shown below.
library(data.table) a <- 1:10 b <- c("a","b","c","d","e","f","g","h","i","j") c <- seq(1.1, .2, length = 10) # in case of data frame dt1 <- data.frame(a,b,c) dt1[vapply(dt1, FUN=is.numeric, FUN.VALUE=NA)] a c 1 1 1.1 2 2 1.0 3 3 0.9 4 4 0.8 5 5 0.7 6 6 0.6 7 7 0.5 8 8 0.4 9 9 0.3 10 10 0.2 # in case of data table dt1 <- data.table(a,b,c) dt1[, vapply(dt1, FUN=is.numeric, FUN.VALUE=NA), with=FALSE] a c 1 1 1.1 2 2 1.0 3 3 0.9 4 4 0.8 5 5 0.7 6 6 0.6 7 7 0.5 8 8 0.4 9 9 0.3 10 10 0.2 -- Best, GG [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.