This is an extremely useful function that lets you create different summaries of columns. You can also nest other functions within it to apply them to your columns.
sum_data <- summarise(weeds, mean(flowers)) # We'll start simple. Generates the mean of the flower column
sum_data <- summarise(group_by(weeds, species), mean(flowers))
# Using the group_by() function within summarise lets you get summaries for groups, in this case "species"
sum_data <- summarise(group_by(weeds,species, soil), mean(flowers), sd(flowers), se=sd(flowers/sqrt(n())))
# Grouped by with species & soil, generating mean, standard deviation & standard error of flowers
The last example generates the mean, sd and se for each factor combination in our dataset. This is pretty useful, particularly for generating bar graphs.
However, its a little complex and can be in a much nicer format.
Use the summarise()
function on the “insecticide”” dataset to answer the following question
Question: In the large fragment, what is the median species richness
12