View source: R/addAggregateOrganismObservations.R
addAggregateOrganismObservations | R Documentation |
Adds aggregate organism observation records to a VegX object from a data frame where rows are observation records.
addAggregateOrganismObservations( target, x, mapping, methods = list(), stratumDefinition = NULL, date.format = "%Y-%m-%d", missing.values = c(NA, "0", ""), verbose = TRUE )
target |
The initial object of class |
x |
A data frame where each row corresponds to one aggregate organism observation. Columns can be varied. |
mapping |
A named list whose elements are strings that correspond to column names in
|
methods |
A list with measurement methods for |
stratumDefinition |
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. |
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
and obsStartDate
values are interpreted as if the previous non-missing value has to be used to define aggregate organism observation.
Missing subPlotName
values are interpreted in that observation refers to the parent plotName.
When stratumName
values are missing the aggregate organism observation is not assigned to any stratum.
When both organismName
and taxonName
are missing (i.e. missing organism identity) the function generates an error.
Missing aggregate organism measurements are 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:
addCommunityObservations()
,
addIndividualOrganismObservations()
,
addPlotGeometries()
,
addPlotLocations()
,
addPlotObservations()
,
addSiteCharacteristics()
,
addSiteObservations()
,
addStratumObservations()
,
addSurfaceCoverObservations()
,
addTaxonBySiteData()
# Load source data data(mokihinui) # Define mapping mapping = list(plotName = "Plot", obsStartDate = "PlotObsStartDate", taxonName = "NVSSpeciesName", stratumName = "Tier", cover = "Category") # Define abundance scale coverscale = defineOrdinalScaleMethod(name = "Recce cover scale", description = "Recce recording method by Hurst/Allen", subject = "plant cover", citation = "Hurst, JM and Allen, RB. (2007) The Recce method for describing New Zealand vegetation – Field protocols. Landcare Research, Lincoln.", codes = c("P","1","2","3", "4", "5", "6"), quantifiableCodes = c("1","2","3", "4", "5", "6"), breaks = c(0, 1, 5, 25, 50, 75, 100), midPoints = c(0.05, 0.5, 15, 37.5, 62.5, 87.5), definitions = c("Presence", "<1%", "1-5%","6-25%", "26-50%", "51-75%", "76-100%")) # Define strata strataDef = defineMixedStrata(name = "Recce strata", description = "Standard Recce stratum definition", citation = "Hurst, JM and Allen, RB. (2007) The Recce method for describing New Zealand vegetation – Field protocols. Landcare Research, Lincoln.", heightStrataBreaks = c(0, 0.3,2.0,5, 12, 25, 50), heightStrataNames = paste0("Tier ",1:6), categoryStrataNames = "Tier 7", categoryStrataDefinition = "Epiphytes") # Create new Veg-X document with aggregate organism observations x = addAggregateOrganismObservations(newVegX(), moki_tcv, mapping = mapping, methods = list(cover=coverscale), stratumDefinition = strataDef) # Inspect the result head(showElementTable(x, "aggregateOrganismObservation")) # Example with individual counts data(mtfyffe) mapping = list(plotName = "Plot", subPlotName = "Subplot", obsStartDate = "PlotObsStartDate", taxonName = "NVSSpeciesName", stratumName = "Tier", counts = "Value") strataDef = defineHeightStrata(name = "Standard seedling/sapling strata", description = "Seedling/sapling stratum definition", heightBreaks = c(0, 15, 45, 75, 105, 135, 200), strataNames = as.character(1:6), strataDefinitions = c("0-15 cm", "16-45 cm", "46-75 cm", "76-105 cm", "106-135 cm", "> 135 cm")) x = addAggregateOrganismObservations(newVegX(), mtfyffe_counts, mapping, methods = list(counts="Individual plant counts"), stratumDefinition = strataDef) head(showElementTable(x, "aggregateOrganismObservation")) # Example with frequency in transects data(takitimu) mapping = list(plotName = "Plot", subPlotName = "Subplot", obsStartDate = "PlotObsStartDate", taxonName = "NVSSpeciesName", freq = "Value") x = addAggregateOrganismObservations(newVegX(), taki_freq, mapping, methods = list(freq="Plant frequency/%")) head(showElementTable(x, "aggregateOrganismObservation"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.