Package {Rveg}


Title: Digitization of Phytosociological Relevés
Version: 0.2.0
Description: Digitizes, manages, and classifies phytosociological vegetation plots. Includes a checklist of Czech vascular plants based on Danihelka, Chrtek, and Kaplan (2012) https://www.preslia.cz/article/159. Imports vegetation data from 'TURBOVEG' (Hennekens and Schaminée, 2001) <doi:10.2307/3237010> and exports data for 'JUICE' (Tichý, 2002) <doi:10.1111/j.1654-1103.2002.tb02069.x>. Supports vegetation classification using 'CzechVeg-ESy' expert rules (Chytrý et al., 2020) <doi:10.5281/zenodo.3605562> and a constancy-based classifier inspired by 'VegKey' (Tichý and Chytrý, 2019) <doi:10.1111/jvs.12799>. The bundled default classification model was trained on 'CzechVeg-OpenStrat' (Chytrý et al., 2026) <doi:10.5281/zenodo.19231152>. Resolves plant synonyms using the World Checklist of Vascular Plants (Govaerts et al., 2021) <doi:10.1038/s41597-021-00997-6>, the taxonomic backbone of 'Plants of the World Online'. For package methodology, see Král and Douda (2025) <doi:10.1111/jvs.70012>.
URL: https://plant-ecology-lab-czu.com/resources/rveg/, https://github.com/sesitcsl2/Rveg
BugReports: https://github.com/sesitcsl2/Rveg/issues
License: GPL (≥ 3)
Encoding: UTF-8
Imports: utils, xml2
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-11-24 21:49:52 UTC; premek
Author: Přemysl Král ORCID iD [aut, cre], Jan Douda ORCID iD [aut]
Maintainer: Přemysl Král <kralp@fzp.czu.cz>
Repository: CRAN
Date/Publication: 2026-11-25 08:30:40 UTC

Rveg: Digitization of Phytosociological Relevés

Description

Simple and fast tool for transforming phytosociological vegetation data into digital form for the following analysis. For detailed guide run vignette("Rveg","Rveg") or check the quick start guide on https://github.com/sesitcsl2/Rveg

Author(s)

Maintainer: Přemysl Král kralp@fzp.czu.cz (ORCID)

Authors:

References

Král, P. and Douda, J. (2025). "Introducing Rveg: An R Package for Phytosociological Data Digitizing". Journal of Vegetation Science 36: e70012. doi:10.1111/jvs.70012

Danihelka, J., Chrtek, J. and Kaplan, Z. (2012). "Checklist of vascular plants of the Czech Republic". Preslia 84: 647-811. https://www.preslia.cz/article/159

Hennekens, S.M. and Schaminée, J.H.J. (2001). "TURBOVEG, a comprehensive data base management system for vegetation data". Journal of Vegetation Science 12: 589-591. doi:10.2307/3237010

Tichý, L. (2002). "JUICE, software for vegetation classification". Journal of Vegetation Science 13: 451-453. doi:10.1111/j.1654-1103.2002.tb02069.x

Chytrý, M. et al. (2020). "CzechVeg-ESy: Expert system for automatic classification of vegetation plots from the Czech Republic". Zenodo, version v1-2020-01-12. doi:10.5281/zenodo.3605562

Bruelheide, H., Tichý, L., Chytrý, M. and Jansen, F. (2021). "Implementing the formal language of the vegetation classification expert systems (ESy) in the statistical computing environment R". Applied Vegetation Science 24: e12562. doi:10.1111/avsc.12562

Tichý, L. (2005). "New similarity indices for the assignment of relevés to vegetation units of an existing phytosociological classification". Plant Ecology 179: 67-72. doi:10.1007/s11258-004-5798-8

Tichý, L. and Chytrý, M. (2019). "Probabilistic key for identifying vegetation types in the field: A new method and Android application". Journal of Vegetation Science 30: 1035-1038. doi:10.1111/jvs.12799

Chytrý, M. et al. (2026). "Czech Vegetation Database". Zenodo, version 1.1. doi:10.5281/zenodo.19231152

Govaerts, R. et al. (2021). "The World Checklist of Vascular Plants, a continuously updated resource for exploring global plant diversity". Scientific Data 8: 215. doi:10.1038/s41597-021-00997-6

Govaerts, R. (2026). "The World Checklist of Vascular Plants (WCVP)". Version 16, released on 4 June 2026. Royal Botanic Gardens, Kew. doi:10.15468/6h8ucr

Višňák, R. (1986). "Příspěvek k poznání antropogenní vegetace v severních Čechách, zvláště v městě Liberci". Preslia 58: 353-368. https://www.preslia.cz/archive/Preslia_58_1986_353-368.pdf

Kaplan, Danihelka, Chrtek, Kirschner, Kubát, Štech, and Štěpánek (eds) (2019, ISBN:9788020026606) https://botanospol.cz/cs/node/2681, "Key to the flora of the Czech Republic, Ed. 2., Academia, Praha".

See Also

Useful links:


CreateChecklist: Create a custom checklist for Rveg

Description

Generates a custom species checklist formatted for use within the Rveg package. This function takes a list of full botanical names and deterministically converts them into unique, 7-character ShortName codes.

Rveg includes the following built-in checklists:

Usage

CreateChecklist(specieslist, export = "export")

Arguments

specieslist

Character vector OR Character. Either a vector of full botanical names in your R environment, or a path to a .txt file containing a single column named "FullName".

export

Character. The output path and name for the exported checklist. Defaults to a temporary directory.

Details

ShortName Generation Rules: The function guarantees a unique 7-character code for every species. The first 4 characters always represent a unique Genus code. The remaining 3 characters depend on the taxonomic rank:

Note: If a 7-character code clash occurs, the 7th character is automatically adjusted using trailing letters or alphanumeric fallbacks to ensure absolute uniqueness.

Value

Writes a .txt file containing two columns (ShortName and FullName) to the location specified by export. The output can be then used inside addReleve and other functions.

Examples

  # Example 1: Creating a checklist from a local txt file
  CreateChecklist(
    specieslist = paste0(path.package("Rveg"), "/extdata/SpeciesList"),
  )


CreateESyRules: Write a custom Expert System rule file

Description

Writes vegetation unit definitions and optional species groups to a UTF-8 ESy rule file for RvegClassify().

Usage

CreateESyRules(definitions, file, groups = NULL)

Arguments

definitions

Data frame with one row per unit and columns code (a code without spaces), name (the unit name) and formula (an ESy expression). The optional priority column accepts a single digit or letter per row and defaults to "5".

file

Character. Path to the output rule file.

groups

Named list of character vectors, with one taxon name per element of each vector. Group names can begin with an ESy type prefix followed by a space. Unprefixed names use ⁠###⁠.

Details

Write conditions in angle brackets and combine them with AND, OR and NOT. For example, ⁠<Alnus lusitanica GR 25>⁠ requires cover above 25%. Classification retains matches at the highest matching priority.

Value

Invisibly returns file. Pass the path to the rules argument of RvegClassify().

Examples

definitions <- data.frame(
  code = "A1",
  name = "Alder woodland",
  formula = "<Alnus lusitanica GR 25>"
)
CreateESyRules(definitions, tempfile(fileext = ".txt"))


CreateVegKey: Build a VegKey model for vegetation classification

Description

Builds a VegKey model from classified reference relevés or a synoptic table of taxon constancies and saves it as an RDS file.

Usage

CreateVegKey(
  database = NULL,
  unit_column = NULL,
  synoptic = NULL,
  file,
  unit_name_column = NULL,
  checklist = "default",
  customscale = FALSE,
  exclude_layers = c("7", "8"),
  source = NULL,
  min_constancy = 1e-04,
  constancy_scale = c("percent", "proportion")
)

Arguments

database

Character or list. Path and name of a reference Rveg database, or a list containing a headers data frame with plot_id and the unit fields, and a species data frame with plot_id, taxon_name, layer and cover_pct. Supply either database or synoptic.

unit_column

Character. Header field containing vegetation unit codes. Required when using database.

synoptic

Data frame or character path to a CSV file. Use one row per taxon and unit with columns unit_code, taxon_name and constancy. Optional columns are unit_name, n_plots and dominant_constancy. Use the same scale for both constancy columns.

file

Character. Path to the output .rds file.

unit_name_column

Character. Optional header field containing unit names for a reference database. Unit codes are used when names are missing.

checklist

Character. Species checklist passed to RvegLoad() when reading a reference database from disk.

customscale

Logical. Passed to RvegLoad() to convert custom abundance scales interactively.

exclude_layers

Character vector. JUICE layer codes omitted from reference records and stored in the model for later classification.

source

Optional source information stored in the model.

min_constancy

Numeric. Lower bound on constancy during scoring. Must be greater than 0 and at most 1.

constancy_scale

Character. Use "percent" (0 to 100, the default) or "proportion" (0 to 1) for the constancy columns in synoptic.

Details

For reference relevés, occurrence constancy is the proportion of usable plots in a vegetation unit where the taxon occurs. When cover is known for all usable species records, the function also estimates dominance constancy as the proportion of plots where the taxon exceeds 25% cover.

Value

Invisibly returns file. Pass the path to the model argument of RvegClassify() with method = "vegkey".

Examples

synoptic <- data.frame(
  unit_code = c("A1", "A2"),
  taxon_name = c("Alnus glutinosa", "Fagus sylvatica"),
  constancy = c(80, 65)
)
CreateVegKey(synoptic = synoptic, file = tempfile(fileext = ".rds"))


RvegCheck: Inspect, Validate, Edit and Repair an Rveg Database

Description

A diagnostic and managing utility to verify the health and integrity of an Rveg database. RvegCheck() reads your database, checks for missing or corrupted data, and outputs a summary of the database's current state.

Usage

RvegCheck(database, export = "export", checklist = "default")

Arguments

database

Character. The path and name of the existing Rveg database to inspect (e.g., "path/to/my_db").

export

Character. The output path and name where the modified database will be saved. Defaults to a temporary directory.

checklist

Character. The species checklist to validate the database against. By default, it uses the checklist defined in the database's metadata.

Details

Note: This function is currently under active development. At present, the function serves primarily as a diagnostic and metadata-repair tool. When run, it checks the database for a project_name and project_description. If these are missing, it will interactively prompt the user to supply them. It also prints vital database statistics, including the internal ID, creation date, last modification date, and any custom species added to the checklist.

In future updates, this function will also allow users to modify core database parameters, such as swapping the underlying species checklist or altering the header schema.

Value

Currently prints diagnostic information directly to the R console. If modifications are made, it exports the updated database files (⁠*HEAD.csv⁠ and ⁠*REL.csv⁠) to the path specified by export.

See Also

RvegMerge for combining databases, RvegCombine for manipulating data within a database.

Examples

if (interactive()) {
  # Inspect the built-in example database
  RvegCheck(
    database = file.path(path.package("Rveg"), "extdata/ExampleDB", "example_1")
  )
}


RvegClassify: Classify Rveg relevés into vegetation units

Description

Classifies relevés from an Rveg database using formal Expert System (ESy) definitions, a VegKey constancy model, or both.

Usage

RvegClassify(
  database,
  method = "esy",
  rules = "CzechVeg-ESy-basic",
  model = "CzechVeg-VegKey",
  synonym_file = "WCVP-Czech",
  plot_id = NULL,
  checklist = "default",
  customscale = FALSE,
  exclude_layers = c("7", "8"),
  top_n = 3L,
  min_fpfi = 0,
  candidate_units = NULL,
  use_dominance = TRUE,
  output = NULL,
  esy_mode = "separate"
)

Arguments

database

Character. Path and name of an Rveg database, or "default" for the example database in RvegLoad().

method

Character vector. One or both of "esy" (the default) and "vegkey".

rules

Character vector. Use "CzechVeg-ESy-basic" (the default), "CzechVeg-ESy-full", or paths to custom ESy rule files. Bundled names and custom paths can be combined in the same vector.

model

Character or list. Use "CzechVeg-VegKey" (the default), a path to a VegKey .rds file, or a loaded RvegVegKey model from CreateVegKey().

synonym_file

Character. Use "WCVP-Czech" (the default) for the bundled Czech table or "WCVP-Global" for the global WCVP v16 table. If the global table is missing, an interactive session asks before downloading it from the Rveg GitHub release. Declining uses the Czech table. In a non-interactive session, the global table must already be available. You can also pass a path to a UTF-8 TSV (optionally gzip-compressed) with accepted_name and synonyms columns. Separate multiple synonyms with " | ". Use NULL to disable synonym matching.

plot_id

Vector of plot IDs to classify, or NULL to use all plots.

checklist

Character. Species checklist passed to RvegLoad().

customscale

Logical. Passed to RvegLoad() to convert custom abundance scales interactively.

exclude_layers

Character vector. JUICE layer codes omitted from ESy and FPFI. VegKey uses the exclusions stored in the model.

top_n

Integer. Maximum number of ranked FPFI or VegKey results per plot and classification run.

min_fpfi

Numeric. Minimum FPFI score to retain.

candidate_units

Character vector. VegKey unit codes to consider, or NULL to consider all units in the model.

use_dominance

Logical. If TRUE, VegKey uses dominance constancy for taxa with cover above 25% when the model includes it.

output

Character. Directory for classification.csv and taxa.csv, or NULL to skip export.

esy_mode

Character. Use "separate" to evaluate each ESy file independently or "merge" to evaluate rules jointly and apply priorities across files.

Details

ESy retains all formal matches at the highest matching priority. A missing header value can make the classification uncertain if it affects a rule at or above that priority. When the rule file contains a similarity profile, FPFI ranks the formal matches or, for plots with no formal match, all units represented in that profile.

VegKey ranks units by the product of the constancies of the recorded taxa. Relative scores sum to 100 across the candidate units before truncating the ranking to top_n.

Value

For one method, a list containing a plot-level summary and a taxon_map of original and matched names. ESy also returns all_matches and fpfi_ranked. VegKey also returns vegkey_ranked. If both methods are requested, a named list contains one such result per method.

See Also

CreateESyRules(), CreateVegKey()

Examples

## Not run: 
RvegClassify("path/to/my_db", rules = "my_rules.txt", synonym_file = NULL)

## End(Not run)


RvegCombine: Merge Species or Vegetation Layers in an Rveg Database

Description

An interactive utility that allows users to merge the abundance covers of specific species or entire vegetation layers within an existing Rveg database.

Usage

RvegCombine(database, export = "export", checklist = "default")

Arguments

database

Character. The path and name of the existing Rveg database to be modified (e.g., "path/to/my_db").

export

Character. The output path and name where the modified database files (⁠*HEAD.csv⁠ and ⁠*REL.csv⁠) will be saved. Defaults to a temporary directory.

checklist

Character. The species checklist to be used. By default, it uses the checklist defined in the database's metadata.

Details

RvegCombine() operates via a console menu with two primary modes:

Mathematical Consolidation: When both records have positive cover in a relevé, Rveg rounds their probabilistic sum to two decimal places. A single contributing cover is carried forward as recorded.

Combined = C_1 + C_2 \times (1 - \frac{C_1}{100})

Value

Writes two linked CSV files to the location specified by export, representing the modified Rveg database.

See Also

addReleve for data entry, RvegMerge for merging entire databases.

Examples

if (interactive()) {
  RvegCombine(
    database = file.path(path.package("Rveg"), "extdata/ExampleDB", "example_1")
  )
}


RvegLoad: Load an Rveg Database into the R Environment

Description

Reads an existing Rveg database (containing relevé data, header data, and metadata) into R for analysis. By default, it automatically translates the internal 7-character ShortName codes back into full botanical names and extracts the layer information.

Usage

RvegLoad(
  database = "default",
  checklist = "default",
  customscale = FALSE,
  variation = 1
)

Arguments

database

Character. The path and name of the Rveg database to load (e.g., "path/to/my_db"). Defaults to "default", which loads the package's built-in example database.

checklist

Character. The species checklist to use for taxonomy translation. By default, the function uses the checklist specified in the database's metadata.

customscale

Logical. If TRUE, launches an interactive prompt to convert custom abundance scales into numeric percentages. Defaults to FALSE.

variation

Numeric. Determines the format of the returned object (1 to 4). Defaults to 1.

Details

The structure of the imported data is controlled by the variation parameter:

Custom Scales: If customscale = TRUE, the function operates interactively. It will pause and prompt the user to manually define percentage replacements for any custom abundance symbols found in the data.

Value

A data frame if variation = 1, or a list containing data frames and metadata for variants 2 to 4.

Examples

# Example 1: Load the built-in Rveg database into a single data frame
my_data <- RvegLoad()

# Example 2: Load the database as a list with separated Header and Releve tables
my_list <- RvegLoad(variation = 3)


RvegMerge: Merge Two Rveg Databases

Description

Combines two separate Rveg databases into a single, unified database. This function cleanly merges both the species composition data (REL) and the environmental plot header data (HEAD), and seamlessly combines their metadata.

Usage

RvegMerge(database_1, database_2, export = "export")

Arguments

database_1

Character. The path and name of the first Rveg database (e.g., "path/to/db1").

database_2

Character. The path and name of the second Rveg database (e.g., "path/to/db2").

export

Character. The output path and name where the merged database files (⁠*HEAD.csv⁠ and ⁠*REL.csv⁠) will be saved. Defaults to a temporary directory.

Details

During the merge process:

Value

Writes two linked CSV files to the location specified by export, representing the combined Rveg database.

See Also

RvegCombine for manipulating data within a single database, addReleve for adding individual relevés.

Examples

# Example: Merging the built-in database with itself
db_path <- file.path(path.package("Rveg"), "extdata/ExampleDB", "example_2")

RvegMerge(
  database_1 = db_path,
  database_2 = db_path
)

RvegToJuice: Export an Rveg Database to JUICE compatible format

Description

Exports an existing Rveg database into a format directly compatible with JUICE, a comprehensive software for vegetation classification. This function processes both the species composition data and the header data, formatting them to meet JUICE's import requirements.

Usage

RvegToJuice(database, export = "export", checklist = "default")

Arguments

database

Character. The path and name of an existing Rveg database to be exported (e.g., "path/to/my_db").

export

Character. The output path and name where the resulting JUICE-compatible files will be saved. Defaults to a temporary directory.

checklist

Character. The species checklist to use. By default, the function attempts to read the checklist specified in the database's metadata. You can override this by providing a custom file path or a built-in dictionary string.

Details

To ensure seamless compatibility with JUICE, this function performs several background transformations:

Value

Writes two text-based CSV files to the location specified by export: one containing the header data (⁠*H.csv⁠) and one containing the relevé species data formatted with JUICE headers (⁠*R.csv⁠).

Examples

# Example: Exporting the built-in example Rveg database to JUICE format
RvegToJuice(
  database = file.path(path.package("Rveg"), "extdata/ExampleDB", "example_1")
)


RvegToTv: Export an Rveg Database to Turboveg Compatible Format

Description

Exports an existing Rveg database into a CSV format compatible with the Turboveg vegetation database management system. The function automatically reconstructs full botanical names from the internal ShortName codes and maps vegetation layers to standard Turboveg abbreviations.

Usage

RvegToTv(database, export = "export", checklist = "default", ver = 3)

Arguments

database

Character. The path and name of the existing Rveg database to be exported (e.g., "path/to/my_db").

export

Character. The output path and name where the resulting Turboveg CSV file(s) will be saved. Defaults to a temporary directory.

checklist

Character. The species checklist used to match Rveg's 7-character ShortName codes back to their full botanical names. Defaults to "default".

ver

Numeric. The target Turboveg version format to export to (either 2 or 3). Defaults to 3.

Details

During export, Rveg's alphanumeric layers are translated into Turboveg's specific layer codes (e.g., 0 becomes ml, 1 becomes hl, 2 becomes s1, 3 becomes t1, and J becomes jl).

The output structure changes depending on the target Turboveg version specified by the ver parameter:

Value

Writes one or two CSV files to the location specified by export, depending on the chosen Turboveg version.

Examples

# Example: Exporting the built-in Rveg database to Turboveg v3 format
RvegToTv(
  database = file.path(path.package("Rveg"), "extdata/ExampleDB", "example_1"),
  ver = 3
)


TvToRveg: Import Turboveg Data into an Rveg Database

Description

Converts a Turboveg export file into a fully functional Rveg database. The function parses plot headers, standardizes species nomenclature against a specified checklist, and maps vegetation layers.

Usage

TvToRveg(tv, export = "export", checklist = "default", Rveglayers = TRUE)

Arguments

tv

Character. The file path to the Turboveg export file (.csv or .xml).

export

Character. The output path and name of the new Rveg database Defaults to a temporary directory.

checklist

Character. The species checklist used to match Turboveg full names to Rveg's 7-character ShortName codes. Defaults to "default". Select one you want to use in your Rveg database or the one most similar to the one used in Turboveg.

Rveglayers

Logical. If TRUE (the default), Turboveg layer codes (e.g., 't', 's', 'h', 'm', 'j') are automatically translated into standard Rveg numeric/character layers (3, 2, 1, 0, J).

Details

This function natively supports both .csv and .xml Turboveg export formats. In Turboveg, either selecet ⁠Standard XML file⁠ or ⁠Spreadsheet table⁠. For spreadsheet export, select semicolon-delimited format and include the requested header data.

During the import process, the function operates interactively:

Value

Writes two linked CSV files (⁠*REL.csv⁠ and ⁠*HEAD.csv⁠ = ⁠Rveg database⁠) to the location specified by export.

Examples

if (interactive()) {
  # Example: Importing a Turboveg CSV export (or use tvexport.xml)
  TvToRveg(
    tv = file.path(path.package("Rveg"), "extdata/ExampleDB", "tvexport.csv"),
    Rveglayers = TRUE
  )
}


addReleve: Digitize and Edit Relevés in an Rveg Database

Description

The core interactive function of the Rveg package. addReleve() launches a console-based menu system that allows users to create new vegetation databases, digitize new relevés, and edit existing ones. It seamlessly manages both the species composition data (REL) and the environmental plot header data (HEAD). Parameter start was removed.

For list of commands in addReleve menu prompt help or ⁠?⁠

Usage

addReleve(
  database = "NEW",
  save = "default",
  checklist = "default",
  customhead = NULL,
  extrahead = NULL,
  metadata = NULL
)

Arguments

database

Character. The path and name of an existing Rveg database (e.g., "path/to/my_db"). Defaults to "NEW" which creates a fresh database.

save

Character. The output path and name where the resulting database files (⁠*HEAD.csv⁠ and ⁠*REL.csv⁠) will be exported. Defaults to a temporary directory.

checklist

Character. The species checklist to use. Can be a built-in checklist (atm: cz_dh2012, Czechia_slovakia_2015, cz_kaplan2019, wcvp_que, wcvp_por) or a file path to a custom txt checklist. Default use cz_dh2012. see function CreateChecklist.

customhead

Character vector. A vector of strings defining completely custom header fields. Overrides the default schema.

extrahead

Character vector. Additional header fields to append to the end of the default or existing header schema.

metadata

Character vector of length 2. Used to store the Project Title and Project Description (e.g., c("Alpine Flora", "Summer 2024 survey")).

Value

Writes two linked CSV files (Rveg database) to the location specified by save: one containing the relevé species data (⁠*REL.csv⁠) and one containing the header data (⁠*HEAD.csv⁠).

Examples

if (interactive()) {
  # Launch the interactive menu for a new database
  addReleve(
    database = "NEW",
    save = "my_new_project",
    metadata = c("Project Title", "Project Description")
  )
}