Learn R Programming

neotoma2 (version 1.0.5)

toWide: toWide

Description

Obtain a wide table with information regarding of samples grouped by variablename and depth/age.

Usage

toWide(
  x,
  variablenames = c(),
  ecologicalgroups = c(),
  elementtypes = c(),
  unit = c(),
  groupby = "age",
  operation = "prop"
)

Value

wide data.frame obtained from long samples

data.frame

Arguments

x

dataframe object with samples

variablenames

Optional vector to filter by specific variable names.

ecologicalgroups

Vector stating the ecological groups to be filtered by, e.g "DIAT", "TRSH"

elementtypes

Label of element type to filter by, e.g. "pollen", "valve"

unit

Label stating which units to filter by, e.g. "NISP"

groupby

Group by 'age' or 'depth'

operation

label or vector of operations to be chosen from: 'prop', 'sum', 'presence'.

Examples

Run this code
# \donttest{
fourcorners <- '{"type": "Polygon",
"coordinates": [[
[-109.36060497194846, 37.69552879956651],
[-107.813845732192, 37.69552879956651],
[-107.813845732192, 36.80303716260222],
[-109.36060497194846, 36.80303716260222], 
[-109.36060497194846, 37.69552879956651]
]]}'

# Download all vertebrate localities within a bounding box.
fc_sites <- neotoma2::get_sites(loc = fourcorners[1])
fc_ds <- neotoma2::get_datasets(fc_sites) %>% 
neotoma2::filter(datasettype=="vertebrate fauna")

fc_dl <- neotoma2::get_downloads(fc_ds)
fc_dl1 <- fc_dl[[1]]

fc_smp <- samples(fc_dl1)
toWide(fc_smp, ecologicalgroups=c('AVES', 'RODE'), 
elementtypes='bone/tooth', unit='present/absent')

# }

Run the code above in your browser using DataLab