41 1.V42 1.V43 1.V44 1.V51 1.V52 1.V53 1.V54
# 9 10 11 12 13 14 15 16 17 18 19 20
A.K.
- Original Message -
From: Rui Barradas
To: Jannis
Cc: r-help
Sent: Tuesday, September 4, 2012 11:30 AM
Subject: Re: [R] tapply to data.frame or matrix
Hello,
Hello,
Here's a way.
test <- as.data.frame(matrix(1:20, ncol = 5, nrow=4))
test.ind <- c(1,1,2,2,2)
lapply(split(colnames(test), test.ind), function(x) unlist(test[, x]))
Hope this helps,
Rui Barradas
Em 04-09-2012 15:40, Jannis escreveu:
Dear R users,
imagine i have a dataframe and an ind
2 matches
Mail list logo