Built a COVID-19 Tracking Resource that looks at statewide data and data for each of the 254 counties with R

Hi R Fam! I’m reposting this from a different channel, but primarily because our resource is mostly built in R. If you can help, that would be awesome. Big things I’m wondering are: how do I call on the list of available files using the aws.s3 package? Right now, I’ve been able execute the code that @Makada_Brookings shared and @Jessica_Williams-Holt reposted recently, but am not sure how to get a list of available CSVs in the bucket. Anyone have tips?
> Just getting started with looking at SafeGraph’s county-level data. Through our organization, I’ve built a COVID-19 Tracking Resource that looks at statewide data and data for each of the 254 counties. Can anyone direct me to resources that would explain what files to pull to get the latest data for each of those geographies, in each of the safegraph datasets available? Thanks!

The AWS.S3 package is not the best documented in the R universe! Let me poke around and see if I can come up with the answer

Agreed. Just trying to figure out how to get a list of the files.

You’ll want to use get_bucket() and potentially specify a “prefix”. See help for get_bucket().

@Matt_Worthington_Texas_2036 i wonder if you were able to get get_bucket to work for you? i have not. could be the prefix argument

finally found the right parameter:
get_bucket_df("sg-c19-response", prefix = "monthly-patterns"). use prefix to specify the desired subdirectory

@Jessica_Williams-Holt I just had a chance to dig into Safegraph this evening and your get_bucket_df() suggestion with the subdirectory worked like magic!

Glad to hear @Matt_Worthington_Texas_2036! Even with @Sean_Davis_NIH s helpful pointer, it took me longer than I’d care to admit to figure this out :joy::sweat_smile:

I can totally relate to that last sentence, except also on a million other occasions in R. :joy:

You know you are an R person if it takes longer to solve the simple problems than the HARD ones.

haha totally

It’s so true. AND if you convince yourself that it’ll be worth it in the long run.