I assigned a matrix to a name which varies with j:
j <- 2L
assign(paste0("pca", j,".FAVAR_fcst", sep=""), matrix(ncol=24, nrow=12))
This works very neat. Then I try to access a column of that matrix
paste0("pca", j,".FAVAR_fcst", sep="")[,2]
and get the following error:
Error in paste0("pca", j, ".FAVAR_fcst", sep = "")[, 2] : incorrect number of dimensions
I've tried several variations and combinations with cat()
, print()
and capture.output()
, but nothing seems to work. I'm not sure what I have to search exactly for and couldn't find a solution. Can you help me?