Skip to content

Instantly share code, notes, and snippets.

Last active January 29, 2019 00:00
Show Gist options
  • Save SimonGoring/0f8cbddfd4869211ae85d3af3a759ffc to your computer and use it in GitHub Desktop.
Save SimonGoring/0f8cbddfd4869211ae85d3af3a759ffc to your computer and use it in GitHub Desktop.
Getting ready for the PAGES ECR Webinar

Getting From There to Here

This webinar is set up as a "storytelling" session, about how I work through my projects that are intended for publication. In practice this is now how I manage most of my projects that involve some element of data exploration and collaboration. I will be live-coding during the presentation and intend to do so in a way that will allow people to follow along to some degree.

The webinar will be recorded and so people should not feel obligated to code along, or to keep up. If you would like to follow along, or revisit the webinar at a later date, these are the programs and R packages that you will need.

Important Links


Recommended Software

To follow along you must at minimum have:

  • R
    • install.packages(pkgs = c("neotoma", "rmarkdown", "DT", "usethis", "assertthat"))
  • pandoc

Suggested Software

Helpful files

We're going to make some files while we work, and also use some external files. In particular we'll be adding some bibliographic files. I generally work with plain text bib files, but you can use eml files with RMarkdown and pandoc. For this webinar I will use a BibTex file attached below as ecr_webinar.bib.

Code Snippets

The first thing we do is download data from neotoma:

get_ds <- neotoma::get_dataset(gpid=c("Germany", "France", "Canada", "United States"))

We then wrap this in an if/else block to help us save time in the future when we render:

ds_file <- paste0("all_ds_v",version,".rds")
if(ds_file %in% list.files("data/output")) {
  get_ds <- readRDS(paste0("data/output/", ds_file))
} else {
  get_ds <- neotoma::get_dataset(gpid=c("Germany", "France", "Canada", "United States"))
  saveRDS(paste0("data/output/", ds_file))

We add a dynamic plot to the report:


We try to get the datasets without any site description elements using an lapply() function:

desc <- lapply(all_ds, function(x) { 
    if ($$description)) { 
    } else { 

no_desc <- Filter(Negate(is.null), desc)
title={The {N}eotoma {P}aleoecology {D}atabase: {A} multi-proxy, international community-curated data resource},
author={Williams, John W. and Grimm, Eric C. and Blois, Jessica and Charles, Donald F. and Davis, Edward and Goring, Simon J. and Graham, Russell W. and Smith, Alison J. and Anderson, Michael and Arroyo-Cabrales, Joaquin and Ashworth, Allan C. and Betancourt, Julio L. and Bills, Brian W. and Booth, Robert K. and Buckland, Philip and Curry, B. Brandon and Giesecke, Thomas and Jackson, Stephen T. and Latorre, Claudio and Nichols, Jonathan and Purdum, Timshel and Roth, Robert E. and Stryker, Michael and Takahara, Hikaru},
journal={Quaternary Research},
publisher={Cambridge University Press}
title = {{neotoma}: A Programmatic Interface to the Neotoma Paleoecological Database},
author = {Simon Goring and Andria Dawson and Gavin L Simpson and Karthik Ram and Russell W Graham and Eric C Grimm and Jack W. Williams},
journal = {Open Quaternary},
year = {2015},
volume = {1},
number = {1},
pages = {2},
url = {},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment