keberwein / blscrapeR

A tool to gather, analyze and visualize data from the Bureau of Labor Statistics (BLS) API. Functions include segmentation, geographic analysis and visualization.
https://github.com/keberwein/blscrapeR
Other
112 stars 11 forks source link

dateCast() on quarterly BED data #25

Open asavagar opened 5 years ago

asavagar commented 5 years ago
df <- bls_api(c("BDS0000000000000000120007LQ5"),
              startyear = 2008, endyear = 2017) %>%
    # Add time-series dates
    dateCast()

The data frame contains 'year' and 'period' columns as returned by the bls_api() function. The 'period' column is Q01, Q02, Q03 or Q04 which dateCast() incorrectly casts to months. For example, year 2010 and period Q03 will cast to date 2010-03-01.

Great package. Thank you.

keberwein commented 5 years ago

Thank you. I'll look into this!

asavagar commented 5 years ago

My workaround to dateCast.R for quarterly time series

df$date <- as.Date(paste(df$year, ifelse(df$period == "M13", 12,
 as.numeric(substr(df$period, 2, 3)))*3, "01", sep = "-"))
Bhabukpokharel commented 5 years ago

using this API how to extract unemployment by states . i can't find anywhere