On 2020-07-24 01:48 +0200, Rasmus Liland wrote:
>       aggregate(x=list("values"=mydata$values),
>                 by=list("sex"=mydata$sex,
>                         "status"=mydata$status),
>                 FUN=sum)
> 
> yields
> 
>         sex status values
>       1   0      0    224
>       2   1      0   5227
>       3   0      1     11
>       4   1      1    552

After reading more in ?aggregate, I 
realized this does the same thing ...

        aggregate(formula=formula("values~sex+status"),
                  FUN=sum,
                  data=mydata)

Attachment: signature.asc
Description: PGP signature

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to