dplyr

Shrub Volume Aggregation


This is a follow-up to Shrub Volume Data Basics.

Dr. Granger wants some summary data of the plants at her sites and for her experiments. Make sure you have her shrub dimensions data.

This code calculates the average height of a plant at each site:

shrub_dims <- read.csv('data/shrub-volume-data.csv')
by_site <- group_by(shrub_dims, site)
avg_height <- summarize(by_site, avg_height = mean(height))
  1. Modify the code to calculate and print the average height of a plant in each experiment.
  2. Use max() to determine the maximum height of a plant at each site.
[click here for output]