Re: [R] using mapply to avoid loops

2009-10-14 Thread David Winsemius
On Oct 14, 2009, at 12:58 AM, Stephen Samaha wrote: Hello, I would like to use mapply to avoid using a loop but for some reason, I can't seem to get it to work. I've included copies of my code below. The first set of code uses a loop (and it works fine), and the second set of code attempts

[R] using mapply to avoid loops

2009-10-13 Thread Stephen Samaha
Hello, I would like to use mapply to avoid using a loop but for some reason, I can't seem to get it to work. I've included copies of my code below. The first set of code uses a loop (and it works fine), and the second set of code attempts to use mapply but I get a "subscript out of bounds" error

Re: [R] using mapply()

2008-01-08 Thread dxc13
Yes, that's it. Thank you again! Dimitris Rizopoulos wrote: > > do you mean the following?: > > out <- rowMeans(matrix(unlist(res), ncol = length(res))) > dim(out) <- dim(res[[1]]) > out > > > Best, > Dimitris > > > Dimitris Rizopoulos > Ph.D. Student > Biostatistical Centre > School

Re: [R] using mapply()

2008-01-08 Thread Dimitris Rizopoulos
do you mean the following?: out <- rowMeans(matrix(unlist(res), ncol = length(res))) dim(out) <- dim(res[[1]]) out Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel:

[R] using mapply()

2008-01-08 Thread dxc13
useR's, This is a follow up question to one I previously asked. Consider the 3-element list below > res [[1]] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] NA NA NA 1.25 0.25 0.75 NA NA NANANANA 1.25 0.25 [2,] 1.25 0.25 0.7