[R] Calculating proportions from a data frame rather than a table
jrkrideau at yahoo.ca
Tue Oct 2 22:48:48 CEST 2007
What am I missing here?
Cannot you just create the table from the data.frame
and apply prop.table()to it?
--- Farrel Buchinsky <fjbuch at gmail.com> wrote:
> When one has raw data it is easy to create a table
> of one variable against
> another and then calculate proportions
> For example
> 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
More information about the R-help