Please upload your final completed lab on the Assignments page in Canvas, as per the instructions below.
You are welcome and expected to ask for help from the instructors if you get stuck: Please also come to the R Bootcamp on Friday—there is coffee and snacks!
# Read in the data dat_tree <- read.table("http://www.simonqueenborough.info/R/data/treespecies_cleandata.txt", header = TRUE, sep = '\t')
Using functions from the *apply family:
What is the mean DBH of each species?
What is the median DBH of dead and alive trees?
What is the maximum DBH of each species?
What is the minimum DBH of each species?
What is the standard deviation of DBH of each species?
What is the sum of the DBH of tree of each species that are alive and dead (Check the help page if you cannot work out how to split a dataframe by two categorical columns).
How many trees of each species are present? Do not use
First, modify the tree data using the
new_tree <- split(dat_tree, dat_tree$species)
new_tree, answer the following:
What kind of object is
How many trees of each species are present? Return this answer as a list and a vector.
# Read in NHV road race results 2015. dat.nhv <- read.table("http://www.simonqueenborough.info/R/data/race-data-full.txt", sep = '\t', header = TRUE)
What is the slowest Pace (
$Pace_mins) for each City?
What was the fastest Pace for each age group?
What was the mean Pace for each sex and age class combination?
Please check the help page for a reminder, if you need to.