search for: answergood

Displaying 1 result from an estimated 1 matches for "answergood".

2011 Jul 27
2
apply is making me crazy...
...0*x),ncol=x)) exampBad = lapply(1:3, function(x)matrix(rnorm(1000*x),ncol=x)) ## Two ways to see what was created: for(k in 1:length(exampGood)) print(dim(exampGood[[k]])) for(k in 1:length(exampBad)) print(dim(exampBad[[k]])) ## Take the cumsum of each row of each matrix answerGood = lapply(exampGood, function(x) apply(x ,1,cumsum)) answerBad = lapply(exampBad, function(x) apply(x ,1,cumsum)) str(answerGood) str(answerBad) ## Take the first element of the final column of each answer for(mat in answerGood){ LastColumn = ncol(mat) print(ma...