: R help
Cc:
Sent: Sunday, May 19, 2013 10:22 AM
Subject: [R] apply and table
Hi there,
I have the following code:
z <- matrix(c("A", "A", "B", "B", "C", "C", "A", "B", "C"), ncol = 3)
apply(z, 2, tabl
On May 19, 2013, at 16:22 , Jinsong Zhao wrote:
> Hi there,
>
> I have the following code:
>
> z <- matrix(c("A", "A", "B", "B", "C", "C", "A", "B", "C"), ncol = 3)
> apply(z, 2, table, c("A", "B", "C"))
>
> which give correct results.
>
> However, the following code:
>
> apply(z[,1,drop=FAL
Hi there,
I have the following code:
z <- matrix(c("A", "A", "B", "B", "C", "C", "A", "B", "C"), ncol = 3)
apply(z, 2, table, c("A", "B", "C"))
which give correct results.
However, the following code:
apply(z[,1,drop=FALSE], 2, table, c("A", "B", "C"))
which does not give what I expect. I ha
3 matches
Mail list logo