Re: [R] trouble calculating rates--sometimes the denominator is missing

2010-03-11 Thread Christopher W. Ryan
Thanks! I think that will do the trick. I had not known of the match function before. Always learn something new on this list. --Chris Christopher W. Ryan, MD SUNY Upstate Medical University Clinical Campus at Binghamton 425 Robinson Street, Binghamton, NY 13904 cryanatbinghamtondotedu If you

[R] trouble calculating rates--sometimes the denominator is missing

2010-03-10 Thread Christopher W. Ryan
Every day I get a csv file containing the names of the 64 schools in our county, the number of students sent home ill, and the number of students absent (plus lots of other variables). The file is cumulative since fall of 2009. It is in long format: one line per school per day. Each line is

[R] trouble calculating rates--sometimes the denominator is missing

2010-03-10 Thread Christopher W. Ryan
One more bit: I got as far as this, thinking it might help: Using a data file that I know has all the necessary denominators, I created a dataframe of school names (as factor) and TotalStudentsEnrolled. data.frame(data$School[!duplicated(data$School)],

Re: [R] trouble calculating rates--sometimes the denominator is missing

2010-03-10 Thread jim holtman
Here is how you can do the lookup: # lookup up the school lkup - read.table(textConnection(1'BENJAMIN FRANKLIN ES' 465 + 2'CALVIN COOLIDGE SCHL'379 + 3'EAST MS' 590 + 4'HORACE MANN SCHL'374 + 5'MAC ARTHUR SCHL'