Hi > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Alecia M Moser > Sent: Thursday, September 19, 2013 7:01 AM > To: r-help@r-project.org > Subject: [R] Replacement function using grouping variable > > Hello - > > I am looking for a function that would allow me to replace specific > columns in one data frame with columns in another data frame using a > grouping variable. > > df <- read.csv("data.csv", header=T) > df1 <- aggregate(df[, c(8,9,10,11,12,27,28)], by=list(df$ID), > FUN=function(x) sub("(.*):", "\\1.", x)) > > How do I replace columns (8,9,10,11,12,27,28) in df with those from df1 > using the ID column?
Maybe ?merge. Petr > > Thank you, > > Alecia > > [[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. ______________________________________________ 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.