View source: R/addPlotLocations.R
| addPlotLocations | R Documentation |
Adds/replaces static plot location information (spatial coordinates, elevation, place names, ...) to plot elements of a VegX object from a data table where rows are plots.
addPlotLocations( target, x, mapping, proj4string = NULL, reset.places = FALSE, toWGS84 = FALSE, methods = list(), missing.values = c(NA, ""), missing.coords = c(NA, 0, ""), missing.elevation = c(NA, 0, ""), verbose = TRUE )
target |
The initial object of class |
x |
A data frame where each row corresponds to one plot. Columns can be varied. |
mapping |
A named list whose elements are strings that correspond to column names in
Note that |
proj4string |
A string with projection attributes (see |
reset.places |
Whether the 'places' vector should be reset before adding new place names. |
toWGS84 |
A boolean flag to indicate that coordinates should be transformed to "+proj=longlat +datum=WGS84". |
methods |
A named list with measurement methods for plot horizontal/vertical location measurements (each being an object of class |
missing.values |
A character vector of values that should be considered as missing data (but see the following). |
missing.coords |
A character vector of values that should be considered as missing coordinates (introduced to allow separate treatment). |
missing.elevation |
A character vector of values that should be considered as missing elevation (introduced to allow separate treatment). |
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 values are interpreted as if the previous non-missing value has to be used to define plot.
Missing subPlotName values are interpreted in that data refers to the parent plotName.
Missing measurements (e.g. elevation, x, y, ...) 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(),
addPlotObservations(),
addSiteCharacteristics(),
addSiteObservations(),
addStratumObservations(),
addSurfaceCoverObservations(),
addTaxonBySiteData()
data(mokihinui)
# Define location mapping
mapping = list(plotName = "Plot", x = "Longitude", y = "Latitude")
# Create new Veg-X document with plot locations
x = addPlotLocations(newVegX(), moki_loc, mapping,
proj4string = "+proj=longlat +datum=WGS84")
# Summary of the new Veg-X document
showElementTable(x, "plot")
# Add 'elevation' from another table (moki_site). This implies considering subplots.
mapping = list(plotName = "Plot", subPlotName = "Subplot", elevation = "Altitude")
x = addPlotLocations(x, moki_site, mapping,
methods = list(elevation = "Elevation/m"))
# Summary of the updated Veg-X document
showElementTable(x, "plot")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.