A = c(10009, 10009, 10009, 10009, 10011, 10011, ...)
B = c(23908, 230908, 230908,230908, 23514, 23514, ...)
I have a dataframe with the above 2 columns. How do I create a third column, C, that is B divided by the number of rows that contains the corresponding value in column A?
I tried the below but the error is: "problem with mutate(), column C".
DF = DF %>%
group_by(A) %>%
mutate(C = B/n(A))