Re: [R] using apply to loop

2007-12-20 Thread Tyler Smith
On 2007-12-21, Louis Martin <[EMAIL PROTECTED]> wrote: > Hi, > > I am running the following loop, but it takes hours to run as n is big. Is > there any way "apply" can be used? Thanks. > ### Start > nclass <- dim(data)[[2]] - 1 > z <- matrix(0, ncol = nclass, nrow = nclass) > n <- dim(

Re: [R] using apply to loop [SEC=UNCLASSIFIED]

2007-12-20 Thread Crombie, Joe
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Louis Martin Sent: Friday, 21 December 2007 11:37 AM To: R-help@r-project.org Subject: [R] using apply to loop Hi, I am running the following loop, but it takes hours to run as n is big. Is there any way "apply" can be u

[R] using apply to loop

2007-12-20 Thread Louis Martin
Hi, I am running the following loop, but it takes hours to run as n is big. Is there any way "apply" can be used? Thanks. ### Start nclass <- dim(data)[[2]] - 1 z <- matrix(0, ncol = nclass, nrow = nclass) n <- dim(data)[[1]] x <- c(1:nclass) # loop starts for(loop in 1:n) {