Hello everyone, a hopefully easy to solve problem from an R novice...
I try to calculate a number of correlation matrices that finally should be combined in a three-dimensional array. Here the my code with an R dataset as an example. ----------------------------------- ## Creation an array of correlation matrices from a rolling window application TS <- EuStockMarkets # Load internal dataset n <- 30 # Choose size of rolling time window T <- c(1:nrow(TS)) # Define number of steps X <- array(data = NA, dim = c(ncol(TS), ncol(TS), nrow(TS))) # Create data array for (t in T[1:(length(T)-n)]){ X[t] = cor(TS[t:(t+n), 1:ncol(TS)], use = "pairwise.complete.obs") } # Calculate correlation matrices --------------------------------- Unfortunately, I only get a warning that the dimensions do not fit... Where is the mistake? THANKS A LOT! Nico ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.