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

remove dplyr as dependency #9

Closed sboysel closed 6 years ago

sboysel commented 6 years ago

perhaps use do.call and rbind instead

apsteinmetz commented 6 years ago

If you prefer to stay in the zoo/xts context for the data you return, it's probably better to lose dplyr. Personally, I prefer to work in the tidyverse so I like my dates as a data column so dplyr is always loaded. lubridate is a great replacement for xts but I realize it's something of a religious issue.

sboysel commented 6 years ago

I use dplyr almost exclusively for the consistent coercion rules of bind_rows. I also find myself most often working with tidyverse loaded but I envisioned fredr as a simple tool to pull in time series objects, letting the user decide how they wanted to convert them after. Note that tidyquant is a more comprehensive solution to unifying time series data and tidyverse principles. That being said, I'm not overly attached to returning time series observations as either xts objects or as data frames / tibbles. I think I will leave the behavior as it it for now and change it if there is a more pressing need in the future.

DavisVaughan commented 6 years ago

Just looking through some of fredr. Like this alot! In riingo, an R interface to Tiingo stock data, I get around the need for dplyr::bind_rows() by doing (in the context of fredr_series()):

tibble::as.tibble(jsonlite::fromJSON(httr::content(resp, "text"))$seriess)

Perhaps you could use that?

sboysel commented 6 years ago

Thanks for the feedback @DavisVaughan ! I like your suggestion so I think I'll go with it. I'm working out the CI kinks in #14 on the remove-dplyr branch.

sboysel commented 6 years ago

Fixed with #14. Note that fredr_series will now return a tibble instead of a time series object.