cpnr: Interactive tutorials for conservation paleobiology

This is a quick tour through the cpnr package amd will show how you how to start the divdyn tutorial.

How to start

After installing and loading the package, you can see what tutorials are currently available with the show_tutorials function:

show_tutorials()
#> # A tibble: 1 x 2
#>   title  description         
#>   <chr>  <chr>               
#> 1 divdyn Fossil data analysis

We can see that there is a tutorial called divdyn. Let’s get a bit more detail for this one.

Further details

If the short description returned from show_tutorials is not sufficient for you to see what the tutorial contains, you can access a more detailed description via show_description. We need the tutorial name as an argument for the function:

show_description(tutorial = "divdyn")
#> [1] "Fossil data analysis. This tutorial is aimed to introduce the `divDyn` package and its applications to data from the fossil record. In particular, you learn how to calculate taxonomic richness, extinction and origination rates from time‐binned fossil data using  state‐of‐the‐art methodology"

If that looks good to you, let’s start the tutorial.

What you need

Each tutorial relies on various packages that might not be installed on your device. Running the tutorial without these packages will fail. It is therefore necessary to check which packages are needed to run the tutorial, and to install them if necessary.

show_dependencies(tutorial = "divdyn")
#> [1] "divDyn"    "knitr"     "learnr"    "rmarkdown" "shiny"

To load all these dependencies needed to run a tutorial, and to install the missing ones, you can run load_depencies:

# get dependencies
packages <- show_dependencies(tutorial = "divdyn")

# load or install them
load_dependencies(packages = packages)

Access the tutorial

Now you should know the name of the tutorial you want to run and what it does based on the description. Further, you have loaded and installed all dependencies needed to run the tutorial. Now you are ready to run it. The start_tutorial function will initiate the interactive tutorial and open it in a browser:

start_tutorial(tutorial = "divdyn")

Make sure to end the tutorial with the stop button in the R console when you are done.