[R] "tapply" and "data.frame"?

From: Zhang Jian <jzhang1982_at_gmail.com>
Date: Tue 23 Jan 2007 - 13:20:53 GMT


I want to transform the data by "tapply" to one dataframe. But I can not get it.
For example:
> tst=tapply(point,pp,length)
> tst[1:10]

  p1 p10 p100 p1000 p1001 p1002 p1003 p1004 p1005 p1006   1 5 1 8 6 5 8 7 4 4
> res=as.data.frame(tst) # I try to transform it
> res[1:10,]

  p1 p10 p100 p1000 p1001 p1002 p1003 p1004 p1005 p1006   1 5 1 8 6 5 8 7 4 4
How to transfrom it like the following:
>res

point ind
1 p1 1
2 p10 5
3 p100 1
4 p1000 8

5 p1001 6

Thanks!

        [[alternative HTML version deleted]]



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 and provide commented, minimal, self-contained, reproducible code. Received on Wed Jan 24 00:23:49 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 23 Jan 2007 - 14:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.