Jim, That's perfect. Thanks.
Also tried Neal's method, but it wound up be MUCH slower to build the index. Thanks, -- Noah Silverman, M.S. UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 On Mar 21, 2013, at 6:07 PM, Jim Holtman <jholt...@gmail.com> wrote: > indx <- match(main.df$id, key$id, nomatch = 0) > main.df$value[indx != 0] <- key$value[indx] > > Sent from my iPad > > On Mar 21, 2013, at 20:57, Noah Silverman <noahsilver...@ucla.edu> wrote: > >> Hello, >> >> I have a large data.frame of 80,000 rows where each row is a record. Each >> record is indexed by a unique ID in the first column. >> >> I need to update values for a column for *some* of the records. I was given >> a data.frame with about 10,000 rows and two columns. The first is the >> record ID, the second is the new values. >> >> The slow way to do this is to loop through the new data (10,000 rows) and >> update the value in the corresponding master data.frame. However this will >> be painfully slow. >> >> Does anyone have a clever way to shortcut the process. In English, what I >> want to do is, "For each row in the update list, lookup the corresponding ID >> in the master data frame and update the value." >> >> >> Ideas? >> >> >> -- >> Noah Silverman, M.S. >> UCLA Department of Statistics >> 8117 Math Sciences Building >> Los Angeles, CA 90095 >> >> ______________________________________________ >> 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. ______________________________________________ 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.