sboysel / fredr

An R client for the Federal Reserve Economic Data (FRED) API
https://sboysel.github.io/fredr/
Other
92 stars 21 forks source link

fredr() and parameter vintage_dates #88

Closed cgarciga closed 3 years ago

cgarciga commented 3 years ago

From https://cran.r-project.org/web/packages/fredr/fredr.pdf under fred_series_observations:

image

However, it appears that fredr cannot accept more than one date for parameter vintage_dates:

image

Ideally, when passing multiple dates to vintage_dates, a fourth column in the return tibble called, for example, vintage_date would denote which vintage that data point is from.

sboysel commented 3 years ago

Nice catch! The API parameter itself accepts a comma separated string of dates but it seems we didn't accommodate for that in the vintage_dates parameter of fredr(). I can take a stab at this shortly.

cgarciga commented 3 years ago

Thanks! And, thanks for the quick response!

sboysel commented 3 years ago

Should be fixed with #89

fredr::fredr(series_id = "GDPC1", vintage_dates = as.Date(c("1991-12-04", "1991-12-20")))
#> # A tibble: 132 x 3
#>    date       series_id value
#>    <date>     <chr>     <dbl>
#>  1 1959-01-01 GDPC1     1910.
#>  2 1959-04-01 GDPC1     1941.
#>  3 1959-07-01 GDPC1     1932.
#>  4 1959-10-01 GDPC1     1943.
#>  5 1960-01-01 GDPC1     1978.
#>  6 1960-04-01 GDPC1     1974.
#>  7 1960-07-01 GDPC1     1976.
#>  8 1960-10-01 GDPC1     1965.
#>  9 1961-01-01 GDPC1     1980.
#> 10 1961-04-01 GDPC1     2009.
#> # … with 122 more rows

Created on 2021-01-04 by the reprex package (v0.3.0)

sboysel commented 3 years ago

This change has now been merged the master branch with #89. Will do another CRAN release soon but in the meantime, you can install with devtools::install_github().

cgarciga commented 3 years ago

Thank you!