This is!
Thank you everyone.
Caveman
On Tue, Mar 15, 2011 at 4:24 PM, Dimitris Rizopoulos <
d.rizopou...@erasmusmc.nl> wrote:
> try the following:
>
> DF <- as.data.frame(matrix(sample(2, 120, TRUE), 10, 12))
>
> Results <- data.frame(
>var = names(DF),
>count = colSums(DF == 1),
>
try the following:
DF <- as.data.frame(matrix(sample(2, 120, TRUE), 10, 12))
Results <- data.frame(
var = names(DF),
count = colSums(DF == 1),
percentage = colMeans(DF == 1)
)
I hope it helps.
Best,
Dimitris
On 3/15/2011 3:13 PM, Orvalho Augusto wrote:
I have a dataset like thi
Try this:
data.frame(count = colSums(x == 1), percentage = colSums(x == 1) / nrow(x))
On Tue, Mar 15, 2011 at 11:13 AM, Orvalho Augusto wrote:
> I have a dataset like this:
>
> q25_1 q25_2 q25_3 q25_4 q25_5 q25_6 q25_7 q25_8 q25_9 q25_10 q25_11
> q25_12
> 1 2 2 1 1 2
3 matches
Mail list logo