Learn R Programming

neotoma2 (version 1.0.8)

toWide: toWide

Description

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

Usage

toWide(
  x,
  variablenames = NA,
  ecologicalgroups = NA,
  elementtypes = NA,
  unit = NA,
  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'.

Author

Socorro Dominguez dominguezvid@wisc.edu

Examples

Run this code
# \donttest{
tryCatch({
fc_sites <- neotoma2::get_datasets(limit=5, datasettype = "vertebrate fauna")
fc_ds <- fc_sites %>%
   neotoma2::get_downloads()
fc_dl1 <- fc_dl[[1]]
fc_smp <- samples(fc_dl1)
toWide(fc_smp, ecologicalgroups=c('AVES', 'RODE'),
       elementtypes='bone/tooth', unit='present/absent')
}, error = function(e) {
message("Neotoma server not responding. Try again later.")
})
# }

Run the code above in your browser using DataLab