[R] Counter
Uwe Ligges
ligges at statistik.tu-dortmund.de
Thu Jul 23 12:56:10 CEST 2009
apply(x, 1, table)
Uwe Ligges
amor Gandhi wrote:
> Hi everyone,
>
> Is there any counter function in R for the following purpose:
> x <- matrix(c(1,1,0,2,1,0,0,2,0,1,2,1,2,1,0,1),nrow=4)
> As I would like to know how many zeros, ones, and twos in each row of x?
>
> Many thank in advance,
> Amor
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
More information about the R-help
mailing list