Counting the occurrences of Favia

Exercise Type: Implementation

favia_favus

Favia favus

Instructions

Calculate the number of occurrences and collections of the genus Favia in this old excerpt from the Paleobiology Database.

  1. Download the occurrence file: favia.csv

  2. Read it into R with read.csv()!

  3. Calculate how many occurrences (rows in the table) the genus has where the stg (stage) column’s value is 87! This indicates Priabonian (Eocene) stage. This should be a single numeric value.

  4. Calculate how many different collections (entries in the collection_no column) there are in this stage! This should be a single numeric value.

  5. Calculate which stg numbers does this genus occur in! This should be a numeric vector.

  6. Calculate the number of occurrences and collections in every stage! These should be two numeric vectors. Please indicate which stages the values in these vectors refer to by adding the stg numbers as the names attribute!

Hint: initially, use a for loop to do this - although we will solve this in more functional way too!