addIndividualOrganismObservations: Add individual organism observation records

View source: R/addIndividualOrganismObservations.R

addIndividualOrganismObservationsR Documentation

Add individual organism observation records

Description

Adds individual organism observation records to a VegX object from a data frame where rows are individual observations.

Usage

addIndividualOrganismObservations(
  target,
  x,
  mapping,
  methods = list(),
  stratumDefinition = NULL,
  date.format = "%Y-%m-%d",
  missing.values = c(NA, "0", ""),
  verbose = TRUE
)

Arguments

target

The initial object of class VegX to be modified

x

A data frame where each row corresponds to one individual organism (e.g. a tree) observation. Columns can be varied.

mapping

A named list whose elements are strings that correspond to column names in x. Names of the list should be:

  • plotName - A string identifying the vegetation plot within the data set (required).

  • subPlotName - A string identifying a subplot of the plot given by plotName (optional).

  • obsStartDate - Plot observation start date (required; see date.format).

  • individualOrganismLabel - The string of a name, defined by the dataset author, and which does not follow nomenclatural codes.

  • organismName - The string of a name, defined by the dataset author, and which does not follow nomenclatural codes.

  • taxonName - The string of a taxon name (not necessarily including authority).

  • stratumName - A string used to identify a stratum (see stratumDefinition; optional).

  • diameterMeasurement - Individual organism (e.g. tree) diameter (optional).

  • heightMeasurement - Individual organism (e.g. tree) height (optional).

  • ... - User defined names used to map additional individual organism measurements (optional).

methods

A named list of objects of class VegXMethodDefinition indicating the definition of 'diameterMeasurement', 'heightMeasurement' and any additional individual organism measurement defined in mapping. Alternatively, methods can be specified using strings if predefined methods exist (see predefinedMeasurementMethod).

stratumDefinition

An object of class VegXStrataDefinition indicating the definition of strata.

date.format

A character string specifying the input format of dates (see as.Date).

missing.values

A character vector of values that should be considered as missing observations/measurements.

verbose

A boolean flag to indicate console output of the data integration process.

Details

The mapping should include either organismName or taxonName, but can include both of them if the source data set contains both taxon names and others that are not taxa. Missing value policy:

  • Missing plotName or obsStartDate values are interpreted as if the previous non-missing value has to be used to define individual organism observation.

  • Missing subPlotName values are interpreted in that observation refers to the parent plotName.

  • When both organismName and taxonName are missing the organism is assumed to be unidentified (i.e. no identity is added).

  • When individualOrganismLabel is missing the function creates a label for the organism.

  • When stratumName values are missing the individual organism observation is not assigned to any stratum.

  • Missing measurements (e.g. diameterMeasurement) are not added to the Veg-X document.

Value

The modified object of class VegX.

References

Wiser SK, Spencer N, De Caceres M, Kleikamp M, Boyle B & Peet RK (2011). Veg-X - an exchange standard for plot-based vegetation data

See Also

Other add functions: addAggregateOrganismObservations(), addCommunityObservations(), addPlotGeometries(), addPlotLocations(), addPlotObservations(), addSiteCharacteristics(), addSiteObservations(), addStratumObservations(), addSurfaceCoverObservations(), addTaxonBySiteData()

Examples

# Load source data
data(mtfyffe)


# Define mapping
mapping = list(plotName = "Plot", subPlotName = "Subplot", obsStartDate = "PlotObsStartDate",
               taxonName = "NVSSpeciesName", individualOrganismLabel = "Identifier",
               diameterMeasurement = "Diameter")


# Create new Veg-X document with individual organism observations
x = addIndividualOrganismObservations(newVegX(), mtfyffe_dia, mapping,
                                      methods = list(diameterMeasurement = "DBH/cm"),
                                      missing.values = c(NA, "(Unknown)", "0",""))

# Inspect the result
head(showElementTable(x, "individualOrganismObservation"))



# Second example without individual labels
data(mokihinui)
mapping = list(plotName = "Plot", subPlotName = "Subplot", obsStartDate = "PlotObsStartDate",
               taxonName = "NVSSpeciesName", diameterMeasurement = "Diameter")
x = addIndividualOrganismObservations(newVegX(), moki_dia, mapping = mapping,
                                      methods = list(diameterMeasurement = "DBH/cm"),
                                      missing.values = c(NA, "(Unknown)", "0",""))
head(showElementTable(x, "individualOrganismObservation"))


miquelcaceres/VegX documentation built on Sept. 18, 2022, 7:04 p.m.