I have a data frame with some rows duplicated by a certain column. I want to take the average in those cases, leaving a data frame with only unique values by that column.
mydf <- data.frame("color"=c("blue", "blue", "red", "orange", "green"), "value"=c(10,30,1,2,3))
This is just a minimal reprex - but my 'real' data is much bigger and more complex. How can I make a new data frame that only lists "blue" once, with a value of 20 (since it's the average) - and leaves everything else untouched?