I have the following dataframe.
Name <- c("John","Mark","Ella","Mike","Zedd","John","Maria","Nick","John","Nick","Zedd","Andrea")
Age <- c(16,25,45,23,26,28,19,20,43,31,33,15)
df <- data.frame(Name,Age)
I want to group by name and sum the years of age. This what I am using without success.
library(dplyr)
new_df <- group_by(Name) %>% summarise(Years = sum(Age)), count = count(Name))