addCommunityObservations: Add community observation records

View source: R/addCommunityObservations.R

addCommunityObservationsR Documentation

Add community observation records

Description

Adds community observation records to a VegX object from a data table where rows are plot observations.

Usage

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

Arguments

target

The initial object of class VegX to be modified

x

A data frame where each row corresponds to one plot observation. Columns can be varied.

mapping

A list with element names 'plotName', 'obsStartDate', used to specify the mapping of data columns (specified using strings for column names) onto these variables. Additional optional mappings are: 'subPlotName'.

methods

A named list of objects of class VegXMethodDefinition with the measurement method for each of the community measurements listed in mapping. List names should be the same as subject measurement variables. Alternatively, methods can be specified using strings if predefined methods exist (see predefinedMeasurementMethod).

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

Missing value policy:

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

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

  • Missing measurements are simply 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(), addIndividualOrganismObservations(), addPlotGeometries(), addPlotLocations(), addPlotObservations(), addSiteCharacteristics(), addSiteObservations(), addStratumObservations(), addSurfaceCoverObservations(), addTaxonBySiteData()

Examples

data(Mokihinui)

# Simulate measurement of basal area
moki_site$BA = pmax(0, rnorm(nrow(moki_site), 10, 5))

# Define mapping
mapping = list(plotName = "Plot", subPlotName = "Subplot",
               obsStartDate = "PlotObsStartDate", basal_area = "BA")


x = addCommunityObservations(newVegX(), moki_site, mapping = mapping,
                        methods = list(basal_area = "Basal area/m2*ha-1"))
                        
# Inspect the result
head(showElementTable(x, "communityObservation"))

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