I'm having trouble creating a column that shows how many times a row has already been repeated, but not in the entire dataset, but in that row.
Ex:
NOME ANO MES COLUNA_QUE_QUERO_CRIAR
A 2016 4 1
A 2016 4 2
B 2016 5 1
B 2016 5 2
B 2016 5 3
What I was able to do is that in this column is the value of the entire dataset. Type, pro A gets 2 and 2, pro B 3 3 and 3, but I want that count.
What I did that gave this result that I did not wish was
dataset %>% group_by(NOME) %>% mutate('COLUNA_QUE_QUERO_CRIAR' = n())
Can anyone help me?