[R] Table to Data Frame

Wolski wolski at molgen.mpg.de
Thu Jun 10 13:04:58 CEST 2004


Hi!


First as Uwe Ligges explained and finally.

do.call("rbind",tab)


Sincerely
Eryk


*********** REPLY SEPARATOR  ***********

On 6/10/2004 at 10:17 PM Ko-Kang Kevin Wang wrote:

>>>[Forwarding on behalf of a colleague]
>>>
>>>She's got a list with several tables:
>>>> tab <- list()
>>>> for(i in 1:6) {
>>>+ tab[[i]] <- table(freq[i])
>>>+ }
>>>> tab
>>>[[1]]
>>>
>>>   0 0.17  0.3  0.5    1  2.5    3    4
>>> 196    2    5    1    5    2    5    2
>>>
>>>[[2]]
>>>
>>>   0 0.17  0.3    1  2.5    3    4
>>> 199    1    3    6    2    6    1
>>>
>>>[[3]]
>>>
>>>  0 0.5
>>>217   1
>>>
>>>[[4]]
>>>
>>>  0 2.5
>>>216   2
>>>
>>>[[5]]
>>>
>>>   0 0.17  0.3  0.5    1  2.5    3    4
>>> 207    1    1    1    1    2    4    1
>>>
>>>[[6]]
>>>
>>>   0 0.17    3
>>> 216    1    1
>>>
>>>
>>>And would like to convert to a data frame, like:
>>>
>>>    0   0.17  0.3  0.5  1
>>>196        2     5     1  5
>>>199        1     3     0  6
>>>217        0     0     1   0
>>>[snip]
>>>
>>>
>>>Basically down the columns she'd like to have the counts.  But because
>>>each
>>>table in the list has got different number of columns, I've been unable
>>>to
>>>convert them into a data frame for her.
>>>
>>>Any help would be greatly appreciated!
>>>
>>>Cheers,
>>>
>>>Kevin
>>>
>>>______________________________________________
>>>R-help at stat.math.ethz.ch mailing list
>>>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>>>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



Dipl. bio-chem. Eryk Witold Wolski    @    MPI-Moleculare Genetic   
Ihnestrasse 63-73 14195 Berlin       'v'    
tel: 0049-30-83875219               /   \    
mail: wolski at molgen.mpg.de        ---W-W----    http://www.molgen.mpg.de/~wolski




More information about the R-help mailing list