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?

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.

Reply via email to