I am trying to set up a 3D matrix in R. I guess this is an easy one. However, I didn't find a solution so far. Let's say we want to create a 365x6x4 matrix. Also crucial form me is how I can change one entry in the matrix. Let's say we want to assign the value 204 to the element [304,5,2]. I highly appreciate your answer!
thanks! best, F
Try this:
ar <- array(someData, c(365, 6, 4));
ar[304,5,2] <- 204;
where someData
might be
someData <- rep(0, 365*6*4);
or even better maybe
someData <- rep(NaN, 365*6*4);