Re: [R] change the for loops with lapply

2010-09-07 Thread Changbin Du
Thanks so much, David! The following codes works! result.fun <- lapply(1:2, function(i) cv.fold(i, 3, 0.3)) On Tue, Sep 7, 2010 at 3:35 PM, David Winsemius wrote: > > On Sep 7, 2010, at 5:43 PM, Changbin Du wrote: > > cv.fold<-function(i, size=3, rang=0.3){ >> cat('Fold ', i, '\n') >>

Re: [R] change the for loops with lapply

2010-09-07 Thread David Winsemius
On Sep 7, 2010, at 5:43 PM, Changbin Du wrote: cv.fold<-function(i, size=3, rang=0.3){ cat('Fold ', i, '\n') out.fold.c <-((i-1)*c.each.part +1):(i*c.each.part) out.fold.n <-((i-1)*n.each.part +1):(i*n.each.part) train.cv <- n.cc[-out.fold.c, c(2:2401, 2417)] train

[R] change the for loops with lapply

2010-09-07 Thread Changbin Du
cv.fold<-function(i, size=3, rang=0.3){ cat('Fold ', i, '\n') out.fold.c <-((i-1)*c.each.part +1):(i*c.each.part) out.fold.n <-((i-1)*n.each.part +1):(i*n.each.part) train.cv <- n.cc[-out.fold.c, c(2:2401, 2417)] train.nv <- n.nn[-out.fold.n, c(2:2401, 2417)]