On 28-11-2012, at 08:00, Berend Hasselman wrote: > ..... >> I'd like to have R find the data.b$ID in data.a$ID and insert the >> corresponding data.a$valueA and data.a$valueB into the appropriate >> columns in data.b. >> >> How can I do this? > > > data.b <- data.a[which(data.a$ID %in% data.b$ID), ]
Of simpler (which is not needed) data.b <- data.a[data.a$ID %in% data.b$ID, ] and if required followed by row.names(data.b) <- NULL Berend ______________________________________________ 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.