I have a dataframe that has lots of columns that are something like this:
data <- data.frame (a.1 = 1:5, a.2b = 3:7, a.5 = 5:9, bt.16 = 4:8, bt.12342 = 7:11)
I'd like a result with columns that sum the variables that have the same prefix. In this example, I want to return a dataframe:
a = (9:13), bt = (11:15)
My real data set is quite a bit more complicated (I want to combine page view counts for web pages with different utm parameters) but a solution for this case should put me on the right track.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…