Adds/replaces static plot geometry information (plot shape, dimensions, ...) to plot elements of a VegX object from a data frame where rows are plots.

addPlotGeometries(
  target,
  x,
  mapping,
  methods = list(),
  missing.values = c(NA, ""),
  verbose = TRUE
)

Arguments

target

The initial object of class VegX to be modified.

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 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).

  • area - Area of the plot (optional).

  • shape - Shape of the plot: circle/circular, rectangle/rectangular/squared, line/linear (optional).

  • radius - Radius of the plot, for circular plots (optional).

  • width - Width of the plot, for rectangular plots (optional).

  • length - Length of the plot, for linear and rectangular plots (optional).

  • bandWidth - Sampling bandwidth, for linear plots (optional).

methods

A list measurement methods for plot geometry measurements (each being an object of class VegXMethodDefinition). Alternatively, methods can be specified using strings if predefined methods exist (see predefinedMeasurementMethod).

missing.values

A character vector of values that should be considered as missing data.

verbose

A boolean flag to indicate console output of the data integration process.

Value

The modified object of class VegX.

Details

Named elements in mapping beyond those used by this function will be ignored. Missing value policy:

  • Missing plotName and shape 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. area, radius,...) are simply not added to the Veg-X document.

References

Wiser SK, Spencer N, De Caceres M, Kleikamp M, Boyle B & Peet RK (2011). Veg-X - an exchange standard for plot-based vegetation data

Examples

# Load source data
data(mokihinui)

# Define location mapping
mapping = list(plotName = "Plot", subPlotName = "Subplot",
               area = "PlotArea", shape = "Shape",
               width = "PlotRectangleLength01", length = "PlotRectangleLength02")

# Define methods
methods = list(area = "Plot area/m2", 
               width = "Plot dimension/m", length = "Plot dimension/m") 

# Create new Veg-X document with plot locations
x = addPlotGeometries(newVegX(), moki_site, mapping, methods)
#>  Measurement method 'Plot area/m2' added for 'area'.
#>  Measurement method 'Plot dimension/m' added for 'width'.
#>  Measurement method 'Plot dimension/m' for 'length' already included.
#>  25 plot(s) parsed, 25 new plot(s) added.
#>  25 record(s) parsed.

# Inspect results
showElementTable(x, "plot")
#>     plotName  area_method area_value     shape    length_method length_value
#> 1     LGM08r Plot area/m2        400 rectangle Plot dimension/m           20
#> 2  LGM08r_1Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 3  LGM08r_2Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 4  LGM08r_3Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 5  LGM08r_4Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 6     LGM16l Plot area/m2        400 rectangle Plot dimension/m           20
#> 7  LGM16l_1Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 8  LGM16l_2Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 9  LGM16l_3Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 10 LGM16l_4Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 11    LGM38h Plot area/m2        400 rectangle Plot dimension/m           20
#> 12 LGM38h_1Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 13 LGM38h_2Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 14 LGM38h_3Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 15 LGM38h_4Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 16    LGM45h Plot area/m2        400 rectangle Plot dimension/m           20
#> 17 LGM45h_2Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 18 LGM45h_3Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 19 LGM45h_4Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 20    LGM43h Plot area/m2        400 rectangle Plot dimension/m           20
#> 21 LGM43h_1Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 22 LGM43h_2Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 23 LGM43h_3Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 24 LGM43h_4Q Plot area/m2        100 rectangle Plot dimension/m           10
#> 25 LGM45h_1Q Plot area/m2        100 rectangle Plot dimension/m           10
#>        width_method width_value relatedPlotName plotRelationship
#> 1  Plot dimension/m          20            <NA>             <NA>
#> 2  Plot dimension/m          10          LGM08r          subplot
#> 3  Plot dimension/m          10          LGM08r          subplot
#> 4  Plot dimension/m          10          LGM08r          subplot
#> 5  Plot dimension/m          10          LGM08r          subplot
#> 6  Plot dimension/m          20            <NA>             <NA>
#> 7  Plot dimension/m          10          LGM16l          subplot
#> 8  Plot dimension/m          10          LGM16l          subplot
#> 9  Plot dimension/m          10          LGM16l          subplot
#> 10 Plot dimension/m          10          LGM16l          subplot
#> 11 Plot dimension/m          20            <NA>             <NA>
#> 12 Plot dimension/m          10          LGM38h          subplot
#> 13 Plot dimension/m          10          LGM38h          subplot
#> 14 Plot dimension/m          10          LGM38h          subplot
#> 15 Plot dimension/m          10          LGM38h          subplot
#> 16 Plot dimension/m          20            <NA>             <NA>
#> 17 Plot dimension/m          10          LGM45h          subplot
#> 18 Plot dimension/m          10          LGM45h          subplot
#> 19 Plot dimension/m          10          LGM45h          subplot
#> 20 Plot dimension/m          20            <NA>             <NA>
#> 21 Plot dimension/m          10          LGM43h          subplot
#> 22 Plot dimension/m          10          LGM43h          subplot
#> 23 Plot dimension/m          10          LGM43h          subplot
#> 24 Plot dimension/m          10          LGM43h          subplot
#> 25 Plot dimension/m          10          LGM45h          subplot