Learn R Programming

neotoma (version 1.3.0)

get_download: Function to return full download records using sites, datasets, or dataset IDs.

Description

Using the dataset ID, site object or dataset object, return all records associated with the data as a download_list.

Usage

get_download(x, verbose = TRUE)

Arguments

x
A single numeric dataset ID or a vector of numeric dataset IDs as returned by get_datasets, or a site, dataset, or dataset_list.
verbose
logical; should messages on API call be printed?

Value

  • This command returns either object of class "try-error"' (see try) definined by the error returned from the Neotoma API call, or an object of class download_list, containing a set of download objects, each with relevant assemblage information and metadata: The download object is a list of lists and data frames that describe an assemblage, the constituent taxa, the chronology, site and PIs who contributed the data. The following are important components:
  • datasetA table describing the collection, including dataset information, PI data compatable with get_contact and site data compatable with get_site.
  • sample.metaDataset information for the core, primarily the age-depth model and chronology. In cases where multiple age models exist for a single record the most recent chronology is provided here.
  • taxon.listThe list of taxa contained within the dataset, unordered, including information that can be used in get_taxa
  • countsThe assemblage data for the dataset, arranged with each successive depth in rows and the taxa as columns. All taxa are described in taxon.list, the chronology is in sample.data
  • lab.dataA data frame of laboratory data, such as exotic pollen spike, amount of sample counted, charcoal counts, etc.
  • chronologiesA list of existing chronologies. If only a single chronology exists for a record then this is the same as the age-model in sample.meta.

Note

The function returns a warning in cases where single taxa are defined by multiple taphonomic characteristics, for example grains that are identified seperately as crumpled and torn in the same sample and sums these values within a sample. In the case that a geochronology dataset is passed to get_download the function returns a message and a NULL object (that is later excized). Use get_geochron for these objects.

References

Neotoma Project Website: http://www.neotomadb.org API Reference: http://api.neotomadb.org/doc/resources/contacts

Examples

Run this code
#  Search for sites with "Pseudotsuga" pollen that are older than 8kyr BP and
#  that are roughly within western British Columbia:
t8kyr.datasets <- get_dataset(taxonname='*Picea*', loc=c(-90, 41, -89, 44),
                              ageold = 20000, ageyoung=10000)

#  Returns 20 records (as of 04/04/2013), get the dataset for all records:
pollen.records <- get_download(t8kyr.datasets)

#  Standardize the taxonomies for the different records using the WS64 taxonomy.
compiled.sites <- compile_taxa(pollen.records, list.name='WS64')

#  Extract the Pseudotsuga curves for the sites:
get.curve <- function(x, taxa) {
               data.frame(site = x$dataset$site.data$site.name,
               age = x$sample.meta$age,
               count = x$counts[,taxa]/rowSums(x$counts, na.rm=TRUE))
             }

curves <- do.call(rbind.data.frame,
                  lapply(compiled.sites, get.curve, taxa = 'Picea'))

#  For illustration, remove the sites with no Pseudotsuga occurance:
curves <- curves[curves$count > 0, ]

smooth.curve <- predict(loess(sqrt(count)~age, data=curves),
                        data.frame(age=seq(20000, 0, by = -100)))
plot(sqrt(count) ~ age, data = curves,
     ylab = '% Pseudotsuga/Larix', xlab='Calibrated Years BP', pch=19,
     col=rgb(0.1, 0.1, 0.1, 0.1), xlim=c(0, 20000))
lines(seq(20000, 0, by = -100), smooth.curve, lwd=2, lty=2, col=2)

#  This figure shows us an apparent peak in Larix/Pseudotsuga pollen in the early-Holocene that
#  lends support to a warmer, drier early-Holocene in western North America.

Run the code above in your browser using DataLab