It is easy to force a table into a data.frame and still keep the tabular structure, but I am not sure why you would want to do that. data.frame(df2[]) The columns of a data.frame are independent variables. The columns of df2 don't stand on their own. ---- Original message ---->Date: Tue, 5 Dec 2006 15:33:13 +0000 (GMT) >From: Milton Cezar Ribeiro <milton_ruser at yahoo.com.br> >Subject: [R] from "table" to "dataframe" >To: R-help <r-help at stat.math.ethz.ch> > >Hi there, > > I have a two-entrance dataframe, and I would like generate a new dataframe with its frequency.I tryed this> > site<-rep(c("s1","s2","s3"),20) >species<-rep(c("a","b","a","c","d"),12) > df<-data.frame(cbind(site,species)) > df2<-table(df) > > But when I convert df2 to data.frame I miss the square format. I would like have my data.framelike this:> > site a b c d > s1 8 4 4 4 > s2 8 4 4 4 > s3 8 4 4 4 > > Any help? > > Miltinho > > >--------------------------------- > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at 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.