Generates unique identifiers for plot elements or plot observation elements

fillUniqueIdentifiers(target, element = "plot", replace.existing = FALSE)

Arguments

target

The initial object of class VegX to be modified

element

The Veg-X main element for which unique identifiers are needed: "plot" or "plotObservation".

replace.existing

A boolean flag to indicate whether newly generated identifiers should replace existing identifiers.

Value

The modified object of class VegX.

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

See also

Other fill functions: fillPartyInformation(), fillProjectInformation()

Examples

# Load source data
data(mokihinui)

# Create a new Veg-X document with projects, plots and plot observations (no data)
mapping = list(projectTitle = "Project", plotName = "Plot", subPlotName = "Subplot",
               obsStartDate = "PlotObsStartDate", obsEndDate = "PlotObsStopDate")
x = addPlotObservations(newVegX(), moki_site, mapping = mapping)
#>  1 project(s) parsed, 1 new project(s) added.
#>  25 plot(s) parsed, 25 new plot(s) added.
#>  25 plot observation(s) parsed, 25 new plot observation(s) added.

# Examine the result
showElementTable(x, "plot")
#>     plotName relatedPlotName plotRelationship
#> 1     LGM08r            <NA>             <NA>
#> 2  LGM08r_1Q          LGM08r          subplot
#> 3  LGM08r_2Q          LGM08r          subplot
#> 4  LGM08r_3Q          LGM08r          subplot
#> 5  LGM08r_4Q          LGM08r          subplot
#> 6     LGM16l            <NA>             <NA>
#> 7  LGM16l_1Q          LGM16l          subplot
#> 8  LGM16l_2Q          LGM16l          subplot
#> 9  LGM16l_3Q          LGM16l          subplot
#> 10 LGM16l_4Q          LGM16l          subplot
#> 11    LGM38h            <NA>             <NA>
#> 12 LGM38h_1Q          LGM38h          subplot
#> 13 LGM38h_2Q          LGM38h          subplot
#> 14 LGM38h_3Q          LGM38h          subplot
#> 15 LGM38h_4Q          LGM38h          subplot
#> 16    LGM45h            <NA>             <NA>
#> 17 LGM45h_2Q          LGM45h          subplot
#> 18 LGM45h_3Q          LGM45h          subplot
#> 19 LGM45h_4Q          LGM45h          subplot
#> 20    LGM43h            <NA>             <NA>
#> 21 LGM43h_1Q          LGM43h          subplot
#> 22 LGM43h_2Q          LGM43h          subplot
#> 23 LGM43h_3Q          LGM43h          subplot
#> 24 LGM43h_4Q          LGM43h          subplot
#> 25 LGM45h_1Q          LGM45h          subplot

# Add unique identifiers
y = fillUniqueIdentifiers(x, "plot")

# Examine the result
showElementTable(y, "plot")
#>     plotName                 plotUniqueIdentifier relatedPlotName
#> 1     LGM08r 2a818a76-2d50-4c03-a4a2-5e67683a42ad            <NA>
#> 2  LGM08r_1Q edd43f96-866c-4785-80ab-01d9ab19a592          LGM08r
#> 3  LGM08r_2Q 47e7ae20-8a1f-43de-9c8e-8cc269e6c593          LGM08r
#> 4  LGM08r_3Q cba7f343-e8d6-4dcc-a70d-c689e75c00b9          LGM08r
#> 5  LGM08r_4Q a64c797c-b3db-46ea-a4e2-badd87df9c7c          LGM08r
#> 6     LGM16l 157b249f-62cb-4bd8-9776-056ce6ef5cf9            <NA>
#> 7  LGM16l_1Q acd28f2f-87fc-4499-b012-0e22e4d3b485          LGM16l
#> 8  LGM16l_2Q 694be016-f97c-440b-a51d-5582bf7eee31          LGM16l
#> 9  LGM16l_3Q 3c06ed56-5d62-4c68-bd10-bfffdf912a68          LGM16l
#> 10 LGM16l_4Q 78ad7fdb-041c-453f-b567-4aafc1955a8b          LGM16l
#> 11    LGM38h 8571b91a-66dd-4738-a2f0-7d89a7c20dd9            <NA>
#> 12 LGM38h_1Q 029d47d4-7970-4dcc-b587-8fe533b717fb          LGM38h
#> 13 LGM38h_2Q 819a01b1-2652-4601-93eb-2dc6b509b0d0          LGM38h
#> 14 LGM38h_3Q da8bd086-9591-41b8-a0d9-81924a5bfa7d          LGM38h
#> 15 LGM38h_4Q 119d8b71-4c2c-4222-9fcb-f311afef99a9          LGM38h
#> 16    LGM45h 6246e6a7-9fc6-411a-bbda-1c8b9be44206            <NA>
#> 17 LGM45h_2Q 846b50d2-b68b-438b-95bd-bd7e4dc29a27          LGM45h
#> 18 LGM45h_3Q 59553558-3161-462f-b5a9-cbb1c4cc30c3          LGM45h
#> 19 LGM45h_4Q 7b96821c-e9e6-4719-a5c8-994e93c2ee16          LGM45h
#> 20    LGM43h 4bfe8f19-e920-42b4-bb01-ff39fd97f24e            <NA>
#> 21 LGM43h_1Q e4c9bae0-ebab-4ef1-b3a9-3b0561e411a5          LGM43h
#> 22 LGM43h_2Q c5a45ac6-e0b4-41de-917c-ef9ffd72942e          LGM43h
#> 23 LGM43h_3Q fe720229-a586-4baf-ba8c-7ca1131a6a0b          LGM43h
#> 24 LGM43h_4Q 34bdbbbe-3f29-45f6-9f47-f91522e5c85a          LGM43h
#> 25 LGM45h_1Q 3aa9d075-842b-4c40-9d30-79545b0e9a31          LGM45h
#>    plotRelationship
#> 1              <NA>
#> 2           subplot
#> 3           subplot
#> 4           subplot
#> 5           subplot
#> 6              <NA>
#> 7           subplot
#> 8           subplot
#> 9           subplot
#> 10          subplot
#> 11             <NA>
#> 12          subplot
#> 13          subplot
#> 14          subplot
#> 15          subplot
#> 16             <NA>
#> 17          subplot
#> 18          subplot
#> 19          subplot
#> 20             <NA>
#> 21          subplot
#> 22          subplot
#> 23          subplot
#> 24          subplot
#> 25          subplot