View source: R/addSiteObservations.R
addSiteObservations | R Documentation |
Adds site observation records to a VegX object from a data table where rows are plot observations.
addSiteObservations( target, x, plotObservationMapping, soilMeasurementMapping = list(), climateMeasurementMapping = list(), waterBodyMeasurementMapping = list(), soilMeasurementMethods = list(), climateMeasurementMethods = list(), waterBodyMeasurementMethods = list(), date.format = "%Y-%m-%d", missing.values = c(NA, ""), fill.methods = FALSE, verbose = TRUE )
target |
The initial object of class |
x |
A data frame where each row corresponds to one plot observation. Columns can be varied. |
plotObservationMapping |
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'. |
soilMeasurementMapping |
A named list used to specify the mapping of data columns to soil variables (e.g. a = "pH" to map variable "pH" of the data frame). List names should be the same as in |
climateMeasurementMapping |
A named list used to specify the mapping of data columns to climate variables. List names should be the same as in |
waterBodyMeasurementMapping |
A named list used to specify the mapping of data columns to water body variables. List names should be the same as in |
soilMeasurementMethods |
A named list of objects of class |
climateMeasurementMethods |
A named list of objects of class |
waterBodyMeasurementMethods |
A named list of objects 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. |
fill.methods |
A flag to indicate that missing methods should be filled with dummy ones. This allows easily storing any environmental data, but without appropriate metadata. |
verbose |
A boolean flag to indicate console output of the data integration process. |
Unlike in other functions, here the element names of mappings are only used to find the corresponding method. The measured subject (e.g. pH, salinity or mean annual temperature) is taken from the method definition.
There is one exception to this rule: users can use fill.methods = TRUE
to skip defining methods for all environmental variables. In this case, the
function will define dummy measurement methods, taking the element name of the mapping list as subject. For example, if
soilMeasurementMapping = list(pHvar = "pH")
and no method is provided for pHvar in soilMeasurementMethods
, the function will create
a dummy measurement method called 'pHvar'. Although this possibility is given to ease import, users are encouraged to define
site measurement methods or to use predefined ones. When defining measurement methods, users should preferably name subjects using the same strings as in predefined methods,
because this facilitates merging datasets where the same entities have been measured.
Please contact Veg-X developers to ask for additional predefined measurement methods if you think they are rellevant for exchanging vegetation plot data.
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.
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()
,
addStratumObservations()
,
addSurfaceCoverObservations()
,
addTaxonBySiteData()
# Load source data data(mokihinui) # Define mapping mapping = list(plotName = "Plot", subPlotName = "Subplot", obsStartDate = "PlotObsStartDate") # Create new Veg-X document with site observations # Uses predefined measurement method "pH/0-14" x = addSiteObservations(newVegX(), moki_site, plotObservationMapping = mapping, soilMeasurementMapping = list(a = "pH") , soilMeasurementMethods = list(a = "pH/0-14")) # Examine results summary(x) head(showElementTable(x, "siteObservation", subject=TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.