#x27; ?
>>
>> Regards
>>
>>
>> On Thu, Sep 17, 2015 at 08:22:10AM +, PIKAL Petr wrote:
>>
>>> Hi
>>>
>>> -Original Message-
>>>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kai Mx
>>>>
oun...@r-project.org] On Behalf Of Kai Mx
Sent: Wednesday, September 16, 2015 10:43 PM
To: r-help mailing list
Subject: [R] aggregate counting variable factors
Hi everybody,
>From a questionnaire, I have a dataset like this one with some 40
items:
df1 <- data.frame(subject=c('user1
ber 16, 2015 10:43 PM
> > To: r-help mailing list
> > Subject: [R] aggregate counting variable factors
> >
> > Hi everybody,
> >
> > >From a questionnaire, I have a dataset like this one with some 40
> > items:
> >
> > df1 <- data.fra
Hi
res <- sapply( df1[ , -1], function( x) table(x)[as.character( 0:5)])
rownames( res) <- paste( sep='', 'result', 0:5)
res[ is.na( res)] <- 0
res
item1 item2 item3 item4 item5
result0 1 0 1 1 0
result1 1 2 0 0 0
result2 1 2 1 1
Hi
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kai Mx
> Sent: Wednesday, September 16, 2015 10:43 PM
> To: r-help mailing list
> Subject: [R] aggregate counting variable factors
>
> Hi everybody,
>
> >From a questio
Hi everybody,
>From a questionnaire, I have a dataset like this one with some 40 items:
df1 <- data.frame(subject=c('user1','user2', 'user3', 'user4'),
item1=c(0,1,2,5), item2=c(1,2,1,2), item3=c(2,3,4,0), item4=c(0,3,3,2),
item5=c(5,5,5,5))
Users can choose an answer from 0 to 5 for each item.
6 matches
Mail list logo