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 want to build a ship, don't drum up the men to gather wood,
divide the work and give orders. Instead, teach them to yearn for the
vast and endless sea." [Antoine de St. Exupery]
jim holtman wrote:
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' 481
+ 6 'THEO ROOSEVELT SCHL' 377"))
>
> # find a match
> lkup[match('HORACE MANN SCHL', lkup[,2]), 3]
[1] 374
>
On Wed, Mar 10, 2010 at 10:44 AM, Christopher W. Ryan
<cr...@binghamton.edu <mailto:cr...@binghamton.edu>> wrote:
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)],
data$TotalStudentsEnrolled[!duplicated(data$School)])
1 BENJAMIN FRANKLIN ES 465
2 CALVIN COOLIDGE SCHL 379
3 EAST MS 590
4 HORACE MANN SCHL 374
5 MAC ARTHUR SCHL 481
6 THEO ROOSEVELT SCHL 377
[truncated]
I thought I might be able to "look up" the necessary value for each
school from this dataframe. But I can't get my head around using
indices to do it.
Thanks again.
--Chris
--
Christopher W. Ryan, MD
SUNY Upstate Medical University Clinical Campus at Binghamton
425 Robinson Street, Binghamton, NY 13904
cryanatbinghamtondotedu
"If you want to build a ship, don't drum up the men to gather wood,
divide the work and give orders. Instead, teach them to yearn for
the vast and endless sea." [Antoine de St. Exupery]
______________________________________________
R-help@r-project.org <mailto: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
<http://www.r-project.org/posting-guide.html>
and provide commented, minimal, self-contained, reproducible code.
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
______________________________________________
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.