Data Structures and Functions for Working with Forest Data
Overview
Provides generic data structures and algorithms for use with forest mensuration data in a consistent framework. The functions and objects included are a collection of broadly applicable tools. More specialized applications should be implemented in separate packages that build on this foundation. Documentation about 'ForestElementsR' is provided by three vignettes included in this package. For an introduction to the field of forest mensuration, refer to the textbooks by Kershaw et al. (2017) doi:10.1002/9781118902028, and van Laar and Akca (2007) doi:10.1007/978-1-4020-5991-9.
Major overhaul of the species coding system.
- Species codings may now be **hierarchical**: a species can appear both as an individual code and inside one or more coarser group codes of the same coding (a laminar family of species sets). Coding tables gained a
levelcolumn (0 = finest leaf, higher numbers = coarser groups).bavrn_stateandtum_wwk_longare now hierarchical. - Codings may carry **non-tree codes** — categories without a tree-species equivalent, such as the Bavarian state code
99("Strauch", shrub). Whether a code is a tree code is **derived** from its link to thespecies_master_table, so there is no separate flag to keep in sync. New exported helpersfe_species_is_tree()andfe_species_non_tree_codes()report this.
Show all changes in 3.0.0Hide the rest of the changes in 3.0.0
fe_stand()and its spatial children now **reject** non-tree species codes with a clear error.- Casting a non-tree code into another coding yields
NA(with a message) instead of raising an error. - **Casting** into a hierarchical coding resolves each species to the finest code that contains it. A cast that loses information (aggregating finer codes into a coarser group) is now signalled with a **message** instead of a **warning**; forward-ambiguous casts still raise an error. A small documented dataset,
species_cast_overrides, declares deliberate target codes for otherwise forward-ambiguous casts. - New exported, CSV-driven builders for maintaining the codings and the master table:
master_template_csv(),master_table_from_csv(),coding_template_from_master(),coding_table_from_template(), andcast_overrides_from_csv(). Coding tables are now stored in a canonical row order (level, then code, then master key), and the builder rejects inconsistent or conflicting entries early. - Extended the species data: new Bavarian state forest species and codes,
tum_wwk_longfilled out with grouping levels and now covering all master species, and additional master species (e.g. the genera *Cedrus* and *Corylus*). - Added two cast overrides for
bavrn_state->tum_wwk_short: the oak group code70("Eiche (Gruppe)") now resolves to6(oak), and the "other hardwood" code80("Sonstige Laubhölzer") to8(other hardwood). Both casts were forward-ambiguous (70straddles{6, 8}via red oak,80straddles{8, 9}hard/soft broadleaf) and therefore errored. This unblocks downstream casting of BaySF inventory data carrying these group codes. - New exported helper
fe_species_get_field_table()returns a compact, field-usable lookup table for a coding: each code exactly once, with the coding's own species/group names (all three languages), plus thelevelandis_treecolumns, in canonical order. Rendering it into a printable document is left to downstream packages. - The "Tree Species Codings" vignette was updated to cover the overhauled system: hierarchical codings and the
levelcolumn, non-tree codes andis_tree, the finest-node cast and the cast-override mechanism, the cast information-loss message (formerly a warning), the new field table, and a rewritten "Information for developers" part documenting the CSV-driven builder workflow.
Other news
- Exported the object validation helpers
has_required_names,has_required_types_or_classes,has_no_missing_values, andis_distinct(previously internal). They remain marked with@keywords internal, but are now part of the public interface so that dependent packages (e.g.FeNEU) can call them with::instead of relying on the non-exported:::mechanism, which is not permitted on CRAN. - Promoted
wood_density_tum_wwk_shortfrom an internal object (insysdata.rda) to a documented, exported dataset. It is now accessible asForestElementsR::wood_density_tum_wwk_short.
***
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- OK13 OK2026-05-07
Show 2 earlier changesHide 2 earlier changes
- ERROR12 OK, 1 ERROR2026-05-05
- OK14 OK2026-03-10
Documentation
- Help pages
- 165 (37 internal)
- Examples that run
- 100%124 run in a plain check
- Exported functions with examples
- 95%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 10% with a bibliography file
Downloads
Dependencies
Installing ForestElementsR adds 54 packages (33 with compiled code, 59 MB of source tarballs). Heaviest: stringi 11 MB, sf 9.3 MB, ggplot2 6.0 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 3.0.0Latest2026-06-29 · current release · diff ↗ ·
added 12 exports
cast_overrides_from_csv, coding_table_from_template, coding_template_from_master, fe_species_get_field_table, fe_species_is_tree, fe_species_non_tree_codes, has_no_missing_values, has_required_names, has_required_types_or_classes, is_distinct, master_table_from_csv, master_template_csv - RR 4.6.0 released · 2026-04-24
- 2.2.0
- RR 4.5.0 released · 2025-04-11
- 2.1.02025-02-07 · diff ↗
- 2.0.12024-12-23
- RR 4.4.0 released · 2024-04-24
Package metadata
- First published
- 2024-12-23
- Total releases
- 4 / 2 yrs
- License
- GPL (>= 3) OSI
- Minimum R
- ≥ 4.4
- Bundled data
- 125 KB / 40 files
- Download size
- 1.6 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("ForestElementsR")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.