I'm wondering if anyone can help?

Hey I’m wondering if anyone can help? I’ve downloaded the post june data and with safegraphR run the following code :

                      by = c('naics_code', 'state_fips', 'county_fips'), 
                      expand_int = 'visits_by_day', recursive = TRUE)```
Problem I'm having is the output is only including state_fips for 0,1,2,3,4,5,6,7,8,9 and not all of the states

If I test this on a file with read_patterns I get all 56 fips with the following code:
```patternsAll <- read_patterns("2020-06-08-weekly-patterns.csv.gz", dir = "~/Downloads/",
+                              naics_link = poi_link,
+                                   by = c('naics_code', 'state_fips', 'county_fips'), 
+                                   expand_int = 'visits_by_day')```

Does anyone know why this is?

Hmm, that’s strange. The code itself looks fine. I wonder if the problem is in the files being picked up. New data (since June) is split into multiple files. If you’re only getting one of them and not the rest that might give you only some of the states. When you run read_many_patterns, it should give the names of the files being opened. Is it only opening one file or is it opening like four or five? It should be four or five.

So it definitely reads in multiple files because when I plot metrics I have to reaggregate for the pre june and post june for them to fall in line and I for some reason get this same phenomena with the pre june data

This is the script I run and the picture on top is the tail of the output data.table I get.

Also this the summary of state_fips I get

Hmm. This is definitely odd, as I’m working wiht the same files and don’t seem to be having this problem. I wonder if something’s off with the fips_from_cbg function. Can you post an example of the first few census block group codes you get when you just run read_patterns?

Thanks again for the help @Nick_H-K_Seattle_University I spent some of the weekend looking into it. Whats super random was that it worked on a file locally but not on the server so I tested it on a file on the server and turns out there was this weird error

1: In require_bit64_if_needed(ans) :
  Some columns are type 'integer64' but package bit64 is not installed. Those columns will print as strange looking floating point data. There is no need to reload the data. Simply install.packages('bit64') to obtain the integer64 print method and print the data again.
2: All formats failed to parse. No formats found. ```
Installed bit64 and the state_fips includdes all

very weird and random but just fwiw

Oh that’s the problem then. fread (which is internal to read_patterns()) requires hte bit64 package to read in 64-bit integers. Otherwise it cuts stuff off and uses scientific notation. Then fips_from_cbg (also internal to read_patterns) gets just the first digit rather than the first two.

Phew!

Thanks so much again!

I should probably add bit64 as a dependency
Thanks for pointing this all out.