mergeVegX | R Documentation |
Merges two Veg-X documents while considering that some of their entities may be shared.
mergeVegX( x, y, allowMergePlots = FALSE, allowMergeOrganismIdentities = FALSE, verbose = TRUE )
x, y |
The objects of class |
allowMergePlots |
If |
allowMergeOrganismIdentities |
If |
verbose |
A flag to indicate console output of the data integration process. |
Some entities are attempted to be merged or are kept as separate entities depeding on their definition:
projects
are merged when their element title
has the same value.
plots
are merged, if allowMergePlots = TRUE
, when they have the same value for element plotName
and, if defined,
plotUniqueIdentifier
are also equal.
plotObservations
are merged when both their plotID
and obsStartDate
elements have the same value
organismIdentities
are merged if they share the same organismName and allowMergeOrganismIdentities = TRUE
because
one can have the same name used in different data sets but referring to different concepts.
methods
are merged when their element name
has the same value.
strata
are merged when their element stratumName
has the same value and the corresponding method has the same name
.
stratumObservations
are merged when both their stratumID
and plotObservationID
elements have the same value.
aggregateOrganismObservations
are merged when their plotObservationID
and organismIdentityID
(and stratumObservationID
, if defined) have the same value
individualOrganisms
are merged when both their plotID
and individualOrganismLabel
have the same value.
individualOrganismObservations
are merged when both their plotObservationID
and individualOrganismID
have the same value.
surfaceTypes
are merged when their element surfaceName
has the same value and the corresponding method has the same name
.
surfaceCoverObservations
are merged when both their surfaceTypeID
and plotObservationID
elements have the same value
siteObservations
are merged into the same element when their element plotObservationID
has the same value, but particular measurements are always added
as if they were distinct pieces of information.
Merging to these entities may cause interruption of the process if the two entities to be merged
have different value for the same element. Other entities (e.g., attributes
of a method) are always considered as distinct
entities between the two data sets to be merged and hence are simply copied to the result.
An object of class VegX
with the pooled data
VegX
data(mokihinui) # Create document 'x' with aggregate taxon observations taxmapping = list(plotName = "Plot", obsStartDate = "PlotObsStartDate", taxonName = "NVSSpeciesName", stratumName = "Tier", cover = "Category") 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%")) 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") x = addAggregateOrganismObservations(newVegX(), moki_tcv, taxmapping, methods = c(cover=coverscale), stratumDefinition = strataDef) # Create document 'y' with tree observations treemapping = list(plotName = "Plot", subPlotName = "Subplot", obsStartDate = "PlotObsStartDate", taxonName = "NVSSpeciesName", diameterMeasurement = "Diameter") diamMeth = predefinedMeasurementMethod("DBH/cm") y = addIndividualOrganismObservations(newVegX(), moki_dia, treemapping, methods = c(diameterMeasurement = diamMeth)) # Merge 'x' and 'y' while keeping plots of the same name separate and # organism identities that have the same name separated. This default behaviour # is set assuming that 'x' and 'y' come from different data sources. z1 = mergeVegX(x,y) summary(z1) # Merge 'x' and 'y' while allowing plots of the same name to be merged # and organism identities that have the same name to be merged. This configuration # should be used when merging two VegX objects that come from the same data source # (i.e. Mokihinui data) z2 = mergeVegX(x,y, allowMergePlots = TRUE, allowMergeOrganismIdentities = TRUE) summary(z2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.