# Count of each value of "PERSOONSNUMMER" in data
count(data, vars = "PERSOONSNUMMER")
# merge with dataset
data_new <- merge(data, new, by = "PERSOONSNUMMER")
# Example
# Create variable of total number of uitkeringen per person
d <- count(uitk, vars = "PERSOONSNUMMER")
uitk <- merge(uitk, d, by = "PERSOONSNUMMER")
colnames(uitk)[colnames(uitk)=="freq"] <- "Total_Nr_Uitk"