Your problem is you can not assign getSymbols with "stk -> getSymbols("SPY"), I had the problem many years ago and came across a torrent of aggression for being rather dull(stupid) when I posted on stackoverflow. I have forgotten the exact switch you need to assign a symbol , I think it maybe auto.assign =FALSE(F is not correct, I am writing in a hurry, please check syntax). But the issue is of that style.here is the proper way to assign names without weird behavior.
symbols <- c("SPY","IWM","QQQ")
prices <- getSymbols(symbols,
src = 'yahoo',
from = "2010-01-01",
auto.assign = TRUE,
warnings = FALSE)
I am sure it will work with that.
I did that 3 minutes ago on 1:58 PM 6/11/22 Australian Eastern Standard Time, works fine yahoo.
It could also be ghosts in the machine happens occasionally, you have to fully uninstall R and Rstudio load the latest version and load all libraries needed again, with install.packages(......., dependencies=TRUE), then load with library, I avoid and never use require command it is inadequate. It is advisable to install and load the latest R Tools library also.