Your solution would work if the data frame contained the raw data. In that case the table function as you outlined would be a table crossing all the levels of column 1 with all the levels of column 2. Instead my data frame is the table. It is an aggregate table (I may be using the wrong buzzwords here).
Can I post an .Rdata file here? If so I would be able to show you what I mean. On 10/3/07, John Kane <[EMAIL PROTECTED]> wrote: > > > --- Farrel Buchinsky <[EMAIL PROTECTED]> wrote: > > > How do you create a table from a data frame? I tried > > as.table( > > name.of.data.frame) but it bombed out. > > I will include the exact error message in my next > > posting. If I recall > > correctly, it said that the data.frame could not be > > coerced to a table. > > I may have misunderstood you. I was just thinking that > you could get individual tables of interest from > data.frame dff by > table(dff[,1],dff[,2]) and so on. > > > > > > > > On 10/2/07, John Kane < [EMAIL PROTECTED]> wrote: > > > > > > What am I missing here? > > > > > > Cannot you just create the table from the > > data.frame > > > and apply prop.table()to it? > > > > > > --- Farrel Buchinsky <[EMAIL PROTECTED]> wrote: > > > > > > > When one has raw data it is easy to create a > > table > > > > of one variable against > > > > another and then calculate proportions > > > > For example > > > > a.nice.table<-table(a,b) > > > > prop.table(a.nice.table,1) > > > > > > > > However, I looked at several papers and created > > a > > > > data frame of the > > > > aggregate data. That means I acually created a > > table > > > > except it is a data > > > > frame. The first column lists the name of the > > first > > > > author and the year. > > > > I cannot find how to convert the data frame to a > > > > table so I can use great > > > > functions such as prop.table and margin.table. > > > > > > > > Alas I tried, rowSums but it provides lousy > > output > > > > without listing the names > > > > of th papers. > > > > I have thought of going through the reshape > > package > > > > but I suspect that there > > > > is an easier way to convert a data frame to a > > table. > > > > Is there? > > > > > > > > -- > > > > Farrel Buchinsky > > > > > > > > > > > > Be smarter than spam. See how smart SpamGuard > > is at giving junk email > > > the boot with the All-new Yahoo! Mail at > > > http://mrd.mail.yahoo.com/try_beta?.intl=ca > > > > > > > > > > > > -- > > Farrel Buchinsky > > GrandCentral Tel: (412) 567-7870 > > > > > > ____________________________________________________ > Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your > favourite sites. Download it now at > http://ca.toolbar.yahoo.com. > -- Farrel Buchinsky GrandCentral Tel: (412) 567-7870 [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.