Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in R Programming by (50.2k points)

I want to perform filtering on the massive US Census data frame by zip-codes that I want. To achieve that I am using tidycensus:

   GEOID NAME        variable  value

   <chr> <chr>       <chr>     <dbl>

 1 77477 ZCTA5 77477 PCT023003 13615

 2 77478 ZCTA5 77478 PCT023003 13260

 3 77479 ZCTA5 77479 PCT023003 38546

 4 77480 ZCTA5 77480 PCT023003  6397

 5 77481 ZCTA5 77481 PCT023003     5

 6 77482 ZCTA5 77482 PCT023003  1832

 7 77483 ZCTA5 77483 PCT023003   277

 8 77484 ZCTA5 77484 PCT023003  8297

 9 77485 ZCTA5 77485 PCT023003  3063

10 77486 ZCTA5 77486 PCT023003  5461

The above is my data-frame, I just want to be able to select certain ZCTA5 values, which I know already.

1 Answer

0 votes
by (108k points)

In R programming, you can perform your filtering with the below code and just replace the values inside c(). I am assuming that your dataset name is "dataset":

library(tidyverse)

dataset %>% filter(NAME %in% c("ZCTA5 77477", "ZCTA5 77484"))

Browse Categories

...