Re: [R] Count or summary data

From: bogdan romocea <br44114_at_gmail.com>
Date: Sat 31 Dec 2005 - 02:04:04 EST

Here's one approach,
v1 <- sample(c(-1,0,1),30,replace=TRUE)
v2 <- sample(c(0.05,0,0.1),30,replace=TRUE)
lst <- split(v1,v2)
counted <- lapply(lst,table)
mat <- do.call("rbind",counted)
print(counted)
print(mat)

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Xiyan Lon
> Sent: Friday, December 30, 2005 9:48 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Count or summary data
>
>
> 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
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Dec 31 02:09:49 2005

This archive was generated by hypermail 2.1.8 : Sat 31 Dec 2005 - 02:53:54 EST