I have a dataset such that the same variable is contained in difference columns for each subject. I want to merge them to the same columns.
E.g.:, I have this dataf
The base transform will do this:
transform
d <- transform(d, DV1 = rowSums(d[c("DV1_A", "DV1_B", "DV1_C")], na.rm=T), DV2 = rowSums(d[c("DV2_A", "DV2_B", "DV2_C")], na.rm=T) )