# Re: [R] Count or summary data

From: jim holtman <jholtman_at_gmail.com>
Date: Sat 31 Dec 2005 - 02:06:55 EST

Here is one way and how to access the data:

> x

[,1] [,2]

``` [1,]   -1 0.05
[2,]    1 0.05
[3,]    1 0.00
[4,]    0 0.05
[5,]   -1 0.00
[6,]    0 0.10
[7,]    1 0.10
[8,]   -1 0.00
[9,]   -1 0.10
[10,]    0 0.05
[11,]    0 0.10
[12,]   -1 0.10
[13,]    1 0.00
```

[14,] -1 0.05
[15,] 1 0.00
> tapply(x[,1], x[,2], table)

\$"0"

-1 1
2 3

\$"0.05"

-1 0 1
2 2 1

\$"0.1"

-1 0 1
2 2 1

> y <- tapply(x[,1], x[,2], table)
> y[["0"]]["-1"]
-1
2
> y[["0.1"]]["0"]
0
2
>

On 12/30/05, Xiyan Lon <xiyanlon@gmail.com> wrote:
>
> Dear all,
> I want to summary and count my data something like
> > te.Ce
> [,1] [,2]
> [1,] -1 0.05
> [2,] 1 0.05
> [3,] 1 0.00
> [4,] 0 0.05
> [5,] -1 0.00
> [6,] 0 0.10
> [7,] 1 0.10
> [8,] -1 0.00
> [9,] -1 0.10
> [10,] 0 0.05
> [11,] 0 0.10
> [12,] -1 0.10
> [13,] 1 0.00
> [14,] -1 0.05
> [15,] 1 0.00
>
> How could I count (summary) all my data which I need the result like
>
> for 0.05
> -1 0 1
> 2 2 1
>
> for 0.00
> -1 0 1
> 2 0 3
>
> for 0.10
> -1 0 1
> 2 2 1
>
> I have tried with summary but I did not find what I need.
> Maybe someone could help me.
> Happy new year.
> Xiyan Lon
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
>

```--
Jim Holtman
Cincinnati, OH
+1 513 247 0281

What the problem you are trying to solve?

[[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help