Dataset HAVE is a tibble edgelist of phone call data from the characters of Recess:
HAVE
Student Friend nCalls TJ Spinelli
We can group by 'student' and mutate to create the new column
mutate
library(dplyr) df %>% group_by(Student) %>% mutate(nCallsPerStudent = sum(nCalls))
Or using base R
base R
df$nCallsPerStudent <- with(df, ave(nCalls, Student, FUN = sum))