On Sat, Sep 20, 2008 at 4:41 PM, Ling, Gary (Electronic Trading) <[EMAIL PROTECTED]> wrote: > Hi R users, > What is the fastest way to replace a(some) value(s) in a (numeric) > vector? > I checked ?replace, but its output is another vector. > 1) I wonder if there's any function to perform in-place replacement? > 2) Or any other function would do what I'm looking for with faster > speed? > > # here is something I tried in R: > n <- 100000 > L <- 1:n
L[1] <- 0 L[n] <- 0 L[c(1, n)] <- 0 ? Hadley -- http://had.co.nz/ ______________________________________________ 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.