Question: I have programming question in R Studio: Now build biggm3 by (i) initializing an empty matrix of appropriate dimension, and (ii) looping 100 times and
I have programming question in R Studio:
Now build biggm3 by (i) initializing an empty matrix of appropriate dimension, and (ii) looping 100 times and inserting gm3 into successive layers of biggm3. You may find the following R function useful:
layerInds <- function(layerNum,nrow) { ((layerNum-1)*nrow + 1):(layerNum*nrow) } # Example use: inds <- layerInds(layer=1,nrow=nrow(gapminder)) range(inds) This is my sample code:
y <- data.frame(a = c(1,2,3,4,5), b = c(6,7,8,9,10), c = c(11,12,13,14,15))
gm3 <- as.matrix(y)
gm3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
