I'm working with SafeGraphR read_many_patterns() and seeing something unexpected. Can someone help?

@Nick_H-K_Seattle_University I’m working with SafeGraphR read_many_patterns() with gen_fips=TRUE. It creates the state_fips column but not the county_fips column that I was also expecting. Do you know why this would happen?

What does your “by” argument look like? If you’re aggregating to the state level, it will drop the county indicators

my “by” is NULL right now, so not aggregating at all.

My end goal is to expand the visitor_home_cbg column and sum over the home cbgs, but I couldn’t get read_patterns() to run with expand_cat = "visitor_home_cbg" so I left that out for now.

                                  gen_fips = TRUE,
                                  filter = 'state_fips == 17',
                                  naics_link = IL_parks,
                                  post_by = FALSE,
                                  start_date = c(rep("2018-01-01",4)),
                                  select = c('safegraph_place_id','raw_visit_counts', 'raw_visitor_counts','visitor_home_cbgs','date_range_start','date_range_end'))```

Ah, I think I know what’s happening. I’ll fix that today. In the meantime, as long as you’re saving the poi_cbg variable, after loading the data you can do

DT[, c(“state_fips”, “county_fips”) := fips_from_cbg(poi_cbg)]

Where DT is the name of the data object you saved your read_many_patterns call as

Ok, thanks

Should be fixed now if you redownload SafeGraphR

Also changed the post_by default to be !is.null(by) so you shouldn’t need to specify post_by = FALSE for your by = NULL call.