SyntaxFix
Write A Post
Hire A Developer
Questions
You could try:
agg <- aggregate(list(x$val1, x$val2, x$val3, x$val4), by = list(x$id1, x$id2), mean)