[R] Basic simple question

jim holtman jholtman at gmail.com
Thu Oct 29 13:01:32 CET 2009


try:

txhd_df <- prec_dist_df[ my_df$STREP %in% my_num, c("COUNTY", "FIPS",
"STSEN", "STREP", "PREC")]

On Thu, Oct 29, 2009 at 1:04 AM, Jim Burke <j.burke at earthlink.net> wrote:
> I have a statement like below.
>
> 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"
> txhd_df <- prec_dist_df[ my_df$STREP=="101", c("COUNTY", "FIPS", "STSEN",
> "STREP", "PREC")]
>
> I would like to make R compare and deliver only the STREPS that are in
> my_num.
>
> A comparative SQL command WHERE STREP
> IN("101","102","103","104","105","107","108","112","113","114","115")
>
> Thanks for any help,
> Jim
>
> ______________________________________________
> R-help at 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list