i want to calculate the mean values based on the id out of a data frame like this:
id | value
1 100
2 200
3 100
1 100
1 100
3 200
2 300
that's what i've coded so far:
ids <- unique(df$id)
for(i in ids){
...
}
how am i able to call only the values with each id to calculate the mean?
outcome (mean) of the example values above should be: 1 = 100, 2 = 250, 3 = 150