Since getting the new version of R, I'm getting stuck on a line of code that used to run without error.
MAGAMM <- rwf(ky_data.MAGA[,6],h=41,drift=T,level=c(90,95),fan = FALSE,lambda = NULL)
Error in stats::arima(x = x, order = order, seasonal = seasonal, xreg = xreg, :
lengths of 'x' and 'xreg' do not match
"rwf" is from the forecast library, but I can't find any information online about other people having this issue. I have had a colleague run the exact same step on his machine which is still running 3.4.0 and it worked. Anyone have an idea of how to fix this?
I've not had this exact issue, but I have had weird issues in the past caused by upgrading R and not updating all my packages. Any chance your packages are out of date?
I'm using a new computer which is why I have the updated R Studio version, so all the packages were installed for the first time with the 3.5.1 version.
what does ky_data.MAGA[,6] look like? Can you create fake data of the same dimension and run rwf? For example, I don't know anything about your data so I created a 10x60 matrix full of random values then used the same logic you used, and it ran:
well that depends on what type of object it is. Here's an example with my m matrix above and then converting that to a data.frame:
m <- matrix(data=rnorm(60),nrow=10,ncol=6)
str(m)
#> num [1:10, 1:6] -1.564 1.939 1.966 -0.388 0.917 ...
m_df <- data.frame(m)
str(m_df)
#> 'data.frame': 10 obs. of 6 variables:
#> $ X1: num -1.564 1.939 1.966 -0.388 0.917 ...
#> $ X2: num 1.131 0.174 1.032 -0.029 1.71 ...
#> $ X3: num -0.00509 1.01644 1.01758 -0.29525 -1.43592 ...
#> $ X4: num -0.6087 -0.7947 2.0995 -0.0696 -1.9768 ...
#> $ X5: num 0.744 2.364 -1.113 -0.505 2.144 ...
#> $ X6: num 1.058 0.714 -0.705 1.037 0.657 ...
for an unlabeled matrix like m the output is num [1:10, 1:6] which tells us it's a matrix of shape 10 x 6. The data.frame reports 'data.frame': 10 obs. of 6 variables: which is a bit more obvious.