From: Rau, Roland
Dear R-Helpers,
I have a matrix where the first column is known. The second column is
the result of multiplying this first column with a constant
"const". The
third column is the result of multiplying the second column with
"const".....
So far, I did it like this (as a simplified example):
nr.of.columns <- 4
myconstant <- 27.5
mymatrix <- matrix(numeric(0), nrow=5, ncol=nr.of.columns)
mymatrix[,1] <- 1:5
for (i in 2:nr.of.columns) {
mymatrix[,i] <- myconstant * mymatrix[,i-1]
}
Can anyone give me some advice whether it is possible to
avoid this loop
(and if yes: how)?
Any suggestions are welcome!
Thanks,
Roland
+++++
This mail has been sent through the MPI for Demographic
Rese...{{dropped}}