[R] frequency tables

Kevin J Emerson kemerson at darkwing.uoregon.edu
Mon Jun 20 20:38:33 CEST 2005


R-masters,

I have a problem that I have been working on for a while and it seems
that there may be a simple solution that I have yet to figure out, so I
thought that I would venture to post to the help list.

Let's say there was a data.frame with three vectors, two that are
factors identifying the data, and one that holds the frequency of
occurrence (the events are binary, yes or no).  I would like to perform
logistic regression on this data, and it seems that I need a vector of
0s and 1s for input into lrm.  How might I convert between a frequency
table and a vector of binary data while still maintaining all identifier
information?

I have thought about using the rep command over and over again and
basically building the data.frame "by hand" but that seems long and
tedious.  Is there a quick and dirty way of doing this?

Thanks in advance!
Kevin
-- 
------------------------------------
------------------------------------
Kevin J Emerson
Center for Ecology and Evolutionary Biology
1210 University of Oregon
University of Oregon
Eugene, OR 97403
kemerson at dakrwing.uoregon.edu




More information about the R-help mailing list