Thanks so much, Marius! It works!
On Thu, Apr 15, 2010 at 1:35 PM, Marius 't Hart <m.t.h...@ai.rug.nl> wrote: > lossw[i] <- cross.validation(file, x)$avg > > change to: > > lossw <- append(lossw,cross.validation(file, x)$avg) > > > > > Changbin Du wrote: > >> HI, Dear community, >> >> I am building the following loop, >> >> ww<-function(file) { >> lossw<-vector() >> for (x in seq(0.1, 0.9, by=0.1)) { >> cat('xweight ', x, '\n') >> >> lossw[i] <- cross.validation(file, x)$avg >> >> } >> return(lossw) } >> >> >> MY question is how to index the lossw[i]? >> >> >> >> for (i in 1:9) >> for (x in seq(0.1, 0.9, by=0.1)) >> >> >> >> Thanks so much! >> >> >> > > -- Sincerely, Changbin -- Changbin Du DOE Joint Genome Institute Bldg 400 Rm 457 2800 Mitchell Dr Walnut Creet, CA 94598 Phone: 925-927-2856 [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.