I was trying to download some data from Yahoo Finance and I used the "yfR" package with the following commands:
library(yfR)
first.date <- Sys.Date()-365
last.date <- Sys.Date()
freq.data <- "daily"
tickers <- c("SPY", "EFA", "IJS", "EEM", "AGG", "FTSEMIB.MI")
l.out <- yf_get(tickers = tickers,
first_date = first.date,
last_date = last.date)
l.wide <- yf_convert_to_wide(l.out)
The last command unfortunately is not working and I really don't know why.
This is the error I get:
Error in `instrument_base_errors()`:
! 'all_of' is not an exported object from 'namespace:tidyr'
Caused by error:
! 'all_of' is not an exported object from 'namespace:tidyr'
Run `rlang::last_error()` to see where the error occurred.
Can someone help me? I don't want to use the package "BatchGetSymbols" because I know it will be deactivated, so if someone has some hints I would appreciate it.
Thanks in advance :)
CodePudding user response:
Short answer: update tidyr.
Slightly longer answer: The root of the issue is that the package source calls tidyr::all_of()
. This really should probably be tidyselect::all_of()
, and I've filed a bug report to that effect. But all_of()
is re-exported by tidyr as of v1.2.0 (changelog), so the function should work as long as your tidyr version is up to date.