Hello, Try the following.
dat <- data.frame(X = rnorm(10), Y = factor(sample(letters, 10)), Z = 1:10) num <- sapply(dat, is.numeric) dat[num] # or dat[, num] Hope this helps, Rui Barradas Em 17-12-2012 10:02, Martin Spindler escreveu:
Dear R users, I have a dataframe which consists of variables of type numeric and factor. What is the easiest way to split up the dataframe to two dataframe which contain all variables of the type numeric resp. factors? Thank you very much for your efforts in advance! Best, Martin ______________________________________________ R-help@r-project.org mailing list 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.
______________________________________________ R-help@r-project.org mailing list 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.