Hello How to pass from table to data-frame ? Thanks
On Aug 3, 2009, at 10:35 AM, Olivier Peron wrote:> Hello > > How to pass from table to data-frame ? >Copied from the help page for table: "The as.data.frame method for objects inheriting from class "table" can be used to convert the array-based representation of a contingency table to a data frame containing the classifying factors and the corresponding entries (the latter as component named by responseName). This is the inverse ofxtabs." -- David Winsemius, MD Heritage Laboratories West Hartford, CT
as.data.frame(table())? 2009/8/3 Olivier Peron <olivier.peron@univ-pau.fr>> Hello > > How to pass from table to data-frame ? > > Thanks > > ______________________________________________ > R-help@r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- _______________ Paulo E. Cardoso [[alternative HTML version deleted]]
Hi, On Aug 3, 2009, at 10:35 AM, Olivier Peron wrote:> Hello > > How to pass from table to data-frame ?R> a <- sample(LETTERS[1:10], 20, replace=T) R> b <- table(a) R> c <- as.data.frame(b) R> c a Freq 1 A 4 2 B 2 3 C 1 4 D 4 5 E 1 6 F 1 7 H 1 8 J 6 -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: cbio.mskcc.org/~lianos/contact
Hi Olivier, How about this? # some data x <- rpois(100,5) # the table table(x) # converting the table as.data.frame.table(table(x)) HTH, Jorge On Mon, Aug 3, 2009 at 10:35 AM, Olivier Peron <olivier.peron@univ-pau.fr>wrote:> Hello > > How to pass from table to data-frame ? > > Thanks > > ______________________________________________ > R-help@r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]