Hi Jim, out_df <- my_df[ my_df$STREP %in% my_num, c("COUNTY", "FIPS", "STSEN", "STREP", "PREC")]
should do the trick. See ?match for details. On Thu, Oct 29, 2009 at 1:53 AM, Jim Burke <j.bu...@earthlink.net> wrote: > I have searched help topics but don't know exactly what to search for. > Need to use my_num to find any matching STREPs in my_df > > my_num <- > c("101","102","103","104","105","107","108","112","113","114","115") > > ## "my_df" has 8,000 different STREPS in it. > > ## I have a statement where I can select ONE item from data frame "my_df" > out_df <- my_df[ my_df$STREP=="101", c("COUNTY", "FIPS", "STSEN", "STREP", > "PREC")] > > ## A comparative SQL command > ## SELECT > ## COUNTY, FIPS, STSEN, STREP, PREC > ## FROM my_df > ## WHERE my_df.STREP > IN("101","102","103","104","105","107","108","112","113","114","115") > ## ORDER BY STREP; > > Thanks for any help, > Jim > > ______________________________________________ > 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. > -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org ______________________________________________ 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.