I have a data frame which contains several variables which got measured at different time points (e.g., test1_tp1, test1_tp2, test1_tp3
test1_tp1
test1_tp2
test1_tp3
Not a dplyr solution, but you can try:
dplyr
cols_2sum <- grepl('test1',colnames(data)) rowMeans(data[,cols_2sum])