I need to aggregate multiple variables of different classes at once.
test<- data.frame (name = c("anna", "joe", "anna"),
party = c("red", "blue", "red"),
text = c("hey there", "we ate an apple", "i took a walk"),
numberofwords = c(2, 4, 4),
score1 = 1:3,
score2 = 4:6)
It looks like this now
# name party text numberofwords score1 score2
#1 anna red hey there 2 1 4
#2 joe blue we ate an apple 4 2 5
#3 anna red i took a walk 4 3 6
I want to aggregate the score1, score2, numberofwords, text variables based on name and party.
The desired result is:
# name party text numberofwords score1 score2
#1 anna red hey there i took a walk 6 4 10
#2 joe blue we ate an apple 4 2 5