Skip to content
Prev 313751 / 398525 Next

Splitting up of a dataframe according to the type of variables

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: