Counting the occurrences of Favia
Exercise Type: Implementation
Favia favus
Instructions
Calculate the number of occurrences and collections of the genus Favia in this old excerpt from the Paleobiology Database.
-
Download the occurrence file: favia.csv
-
Read it into R with
read.csv()
! -
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. -
Calculate how many different collections (entries in the
collection_no
column) there are in this stage! This should be a single numeric value. -
Calculate which
stg
numbers does this genus occur in! This should be a numeric vector. -
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!