Access odd-named object returned by getSymbols

Use back-ticks or get. HNZA.TO <- `HNZ-A.TO` HNZA.TO <- get(“HNZ-A.TO”) Or you could avoid this all-together by setting auto.assign=FALSE in your call to getSymbols. HNZA.TO <- getSymbols(“HNZ-A.TO”, auto.assign=FALSE) You might also want to adjust the column names, via: colnames(HNZA.TO) <- make.names(colnames(HNZA.TO))

Error in model.frame.default: variable lengths differ

Joran suggested to first remove the NAs before running the model. Thus, I removed the NAs, run the model and obtained the residuals. When I updated model2 by inclusion of the lagged residuals, the error message did not appear again. Remove NAs df2<-df1[complete.cases(df1),] Run the main model model2<-gam(death ~ pm10 + s(trend,k=14*7)+ s(temp,k=5), data=df2, family=poisson) … Read more

Can’t download data from Yahoo Finance using Quantmod in R

The price history csv URL’s appear to have changed Old https://chart.finance.yahoo.com/table.csv?s=AAPL&a=2&b=17&c=2017&d=3&e=17&f=2017&g=d&ignore=.csv New: https://query1.finance.yahoo.com/v7/finance/download/AAPL?period1=1492438581&period2=1495030581&interval=1d&events=history&crumb=XXXXXXX The new version appends a “crumb” field which appears to reflect cookie information in the user’s browser. It seems they are intentionally blocking automated downloads of price histories and forcing queries to provide information to validate cookies in a web browser