View source: R/addSurfaceCoverObservations.R
| addSurfaceCoverObservations | R Documentation |
Adds surface cover observation records to a VegX object from a data frame where rows are cover observations.
addSurfaceCoverObservations( target, x, mapping, coverMethod, surfaceTypeDefinition, date.format = "%Y-%m-%d", missing.values = c(NA, ""), verbose = TRUE )
target |
The initial object of class |
x |
A data frame where each row corresponds to one surface cover observation (e.g. bare rock percent cover). Columns can be varied. |
mapping |
A named list whose elements are strings that correspond to column names in
|
coverMethod |
A method definition for surface cover measurements (an object of class |
surfaceTypeDefinition |
An object of class |
date.format |
A character string specifying the input format of dates (see |
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. |
Named elements in mapping other than those used by this function will be ignored. Missing value policy:
Missing plotName, obsStartDate or surfaceName 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 values of coverMeasurement are simply not added to the Veg-X document.
The modified object of class VegX.
Wiser SK, Spencer N, De Caceres M, Kleikamp M, Boyle B & Peet RK (2011). Veg-X - an exchange standard for plot-based vegetation data
Other add functions:
addAggregateOrganismObservations(),
addCommunityObservations(),
addIndividualOrganismObservations(),
addPlotGeometries(),
addPlotLocations(),
addPlotObservations(),
addSiteCharacteristics(),
addSiteObservations(),
addStratumObservations(),
addTaxonBySiteData()
# Load source data
data(mtfyffe)
# Examine surface cover data
head(mtfyffe_groundcover)
# Define mapping
mapping = list(plotName = "Plot", obsStartDate = "PlotObsStartDate",
surfaceName = "PlotGroundCover", coverMeasurement = "Value")
# Get cover measurement method from predefined list
coverMethod = predefinedMeasurementMethod("Surface cover/%")
# Define surface types from the data
unique(mtfyffe_groundcover$PlotGroundCover)
surfaceTypes = defineSurfaceTypes(name = "Default surface types",
description = "Five surface categories",
surfaceNames = c("Vegetation", "Moss", "Litter", "Exposed Soil", "Rock"))
# Create new Veg-X document with surface cover observations
x = addSurfaceCoverObservations(newVegX(), mtfyffe_groundcover, mapping,
coverMethod, surfaceTypes)
# Examine results
head(showElementTable(x, "surfaceCoverObservation"))
# Another example with different surface types
data(takitimu)
head(taki_groundcover)
unique(taki_groundcover$PlotGroundCover)
surfaceTypes = defineSurfaceTypes(name = "Default surface types",
description = "Five surface categories",
surfaceNames = c("Vegetation", "Soil", "Erosion Pavement", "Litter","Rock"))
x = addSurfaceCoverObservations(newVegX(), taki_groundcover, mapping,
coverMethod, surfaceTypes)
head(showElementTable(x, "surfaceCoverObservation"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.