Im wondering if there is a more elegant way to perform this.
Right now, I am grouping all observations by Species. Then I summarize the median values.
median <- iris %>% group_by(Species) %>% summarise(medianSL = median(Sepal.Length), medianSW = median(Sepal.Width), medianPL = median(Petal.Length), medianPW = median(Petal.Width)) I also wanted a column (n) that shows the amount of flowers in each row:
median_n <- iris %>% group_by(Species) %>% tally() Can I combine these two code chunks? So that way the above code chunk will generate a table with the median lengths AND the total n for each row?