Number epochs in geological periods
Exercise Type: Implementation
Instructions
Calculate the number of series/epochs in all Phanerozoic geological systems/periods! Here are the steps that need to be taken:
-  
Download this file: stages.csv
 -  
Read it into R with
read.csv()! -  
Subset to the Phanerozoic!
 -  
Select one system/period, e.g. the
"Jurassic", and subset the result of step 3. to the corresponding part. Count how many different series/epochs there was in it. (length(unique())) -  
Get the names of every system/period, and have these in a vector, where every item occurs only once (character vector).
 -  
Repeat step 4 with a
for()loop, calculate the number of epochs in every period. -  
Assign names to the values.
 
+1. Use the combination of column subsetting, unique() and table() to get the same result (steps 4-7) without writing a loop.
Expected output
A named numeric vector:
- names: periods/systems
 - values: the number of series/epochs in every period.