This is the lab associated with the lesson on Lists in R.
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')
Use the function which() to return which rows of the data pertain to Black Oak.
Use this expression to subset out the rows of data for Black Oak.
Use length() to return the number of trees of Black Oak.
Compare this number to the number of Hickory trees. Are there more Hickory than Black Oak?
Use which() to subset out the rows of data for all the Oak species.
Are there more Oak trees than all of the other species?
# 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)
Use a logical statement to count how many runners were not from New Haven.
How many people ran faster or equal to 20 minutes (dat_nhv$Nettime_mins)?
How many people ran faster than 20 minutes AND were from New Haven?
How many people ran faster than 20 minutes AND were from New Haven, Branford, Guilford, or Madison?
Please check the help page for a reminder, if you need to.
Updated: 2017-10-15