addPlotLocations.Rd
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.
The initial object of class VegX
to be modified
A data frame where each row corresponds to one plot. Columns can be varied.
A named list whose elements are strings that correspond to column names in x
. Names of the list should be:
plotName
- A string identifying the vegetation plot within the data set (required).
subPlotName
- A string identifying a subplot of the plot given by plotName
(optional).
x
, y
- Spatial coordinates of the plot (optional).
elevation
- Elevation of the plot (optional).
authorLocation
- A string describing the location of the plot as made by the author (optional).
locationNarrative
- (optional).
placeName
, placeType
- A string of a place name and place type (e.g. province, county, ...) (optional).
Note that placeName
and placeType
will add new places to the list of places.
A string with projection attributes (see proj4string
of package sp
) to be used when 'x' and 'y' are supplied.
This parameter is needed if toWGS84 = TRUE
.
Whether the 'places' vector should be reset before adding new place names.
A boolean flag to indicate that coordinates should be transformed to "+proj=longlat +datum=WGS84".
A named list with measurement methods for plot horizontal/vertical location measurements (each being an object of class VegXMethodDefinition
).
Alternatively, methods can be specified using strings if predefined methods exist (see predefinedMeasurementMethod
).
For example, methods = c(xy = method1, elevation = method2)
. Measurement method for coordinates is not required, but that for 'elevation' is.
A character vector of values that should be considered as missing data (but see the following).
A character vector of values that should be considered as missing coordinates (introduced to allow separate treatment).
A character vector of values that should be considered as missing elevation (introduced to allow separate treatment).
A boolean flag to indicate console output of the data integration process.
The modified object of class VegX
.
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.
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")
#> 5 plot(s) parsed, 5 new plot(s) added.
#> 5 record(s) parsed.
# Summary of the new Veg-X document
showElementTable(x, "plot")
#> plotName coordX coordY spatialReference
#> 1 LGM45h 172.0326 -41.5559 +proj=longlat +datum=WGS84
#> 2 LGM08r 172.1407 -41.5417 +proj=longlat +datum=WGS84
#> 3 LGM38h 172.0562 -41.5417 +proj=longlat +datum=WGS84
#> 4 LGM43h 172.0414 -41.5490 +proj=longlat +datum=WGS84
#> 5 LGM16l 172.0729 -41.5283 +proj=longlat +datum=WGS84
# 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"))
#> Measurement method 'Elevation/m' added for 'elevation'.
#> 25 plot(s) parsed, 20 new plot(s) added.
#> 25 record(s) parsed.
#> 20 record(s) with missing value(s) not added.
# Summary of the updated Veg-X document
showElementTable(x, "plot")
#> plotName coordX coordY spatialReference elevation_method
#> 1 LGM45h 172.0326 -41.5559 +proj=longlat +datum=WGS84 Elevation/m
#> 2 LGM08r 172.1407 -41.5417 +proj=longlat +datum=WGS84 Elevation/m
#> 3 LGM38h 172.0562 -41.5417 +proj=longlat +datum=WGS84 Elevation/m
#> 4 LGM43h 172.0414 -41.5490 +proj=longlat +datum=WGS84 Elevation/m
#> 5 LGM16l 172.0729 -41.5283 +proj=longlat +datum=WGS84 Elevation/m
#> 6 LGM08r_1Q NA NA <NA> <NA>
#> 7 LGM08r_2Q NA NA <NA> <NA>
#> 8 LGM08r_3Q NA NA <NA> <NA>
#> 9 LGM08r_4Q NA NA <NA> <NA>
#> 10 LGM16l_1Q NA NA <NA> <NA>
#> 11 LGM16l_2Q NA NA <NA> <NA>
#> 12 LGM16l_3Q NA NA <NA> <NA>
#> 13 LGM16l_4Q NA NA <NA> <NA>
#> 14 LGM38h_1Q NA NA <NA> <NA>
#> 15 LGM38h_2Q NA NA <NA> <NA>
#> 16 LGM38h_3Q NA NA <NA> <NA>
#> 17 LGM38h_4Q NA NA <NA> <NA>
#> 18 LGM45h_2Q NA NA <NA> <NA>
#> 19 LGM45h_3Q NA NA <NA> <NA>
#> 20 LGM45h_4Q NA NA <NA> <NA>
#> 21 LGM43h_1Q NA NA <NA> <NA>
#> 22 LGM43h_2Q NA NA <NA> <NA>
#> 23 LGM43h_3Q NA NA <NA> <NA>
#> 24 LGM43h_4Q NA NA <NA> <NA>
#> 25 LGM45h_1Q NA NA <NA> <NA>
#> elevation_value relatedPlotName plotRelationship
#> 1 82 <NA> <NA>
#> 2 95 <NA> <NA>
#> 3 50 <NA> <NA>
#> 4 77 <NA> <NA>
#> 5 94 <NA> <NA>
#> 6 NA LGM08r subplot
#> 7 NA LGM08r subplot
#> 8 NA LGM08r subplot
#> 9 NA LGM08r subplot
#> 10 NA LGM16l subplot
#> 11 NA LGM16l subplot
#> 12 NA LGM16l subplot
#> 13 NA LGM16l subplot
#> 14 NA LGM38h subplot
#> 15 NA LGM38h subplot
#> 16 NA LGM38h subplot
#> 17 NA LGM38h subplot
#> 18 NA LGM45h subplot
#> 19 NA LGM45h subplot
#> 20 NA LGM45h subplot
#> 21 NA LGM43h subplot
#> 22 NA LGM43h subplot
#> 23 NA LGM43h subplot
#> 24 NA LGM43h subplot
#> 25 NA LGM45h subplot