| Type: | Package |
| Title: | Routines for Evaluating Forest Inventory Data |
| Version: | 3.0.2 |
| Date: | 2026-08-27 |
| Description: | Provides a collection of routines for evaluating data from larger forest management units, typically sample inventories, but also stand-wise inventories. The idea is to support modern forest planning approaches and to be open by design to new data sources and evaluation methods. For the methodological background of forest inventories see Kangas and Maltamo (2006) "Forest Inventory: Methodology and Applications" <doi:10.1007/1-4020-4381-3>. |
| License: | AGPL (≥ 3) |
| Encoding: | UTF-8 |
| Imports: | tibble, dplyr, purrr, rlang, Rdpack, tidyr, readr, ggplot2, tidyselect (≥ 1.2.0), foreach, doSNOW, lifecycle, parallel, progressr, stringr, stringdist, sf |
| RdMacros: | Rdpack |
| Depends: | R (≥ 4.4), ForestElementsR (≥ 3.0.0) |
| Suggests: | knitr, kableExtra, rmarkdown, tinytex, testthat (≥ 3.0.0) |
| SystemRequirements: | pandoc (>= 1.12.3) and a LaTeX distribution (e.g. TinyTeX, see ?tinytex::install_tinytex) with the booktabs, longtable, siunitx, and makecell LaTeX packages are required for the *_pdf() output functions. |
| Config/testthat/edition: | 3 |
| LazyData: | true |
| VignetteBuilder: | knitr |
| Config/roxygen2/version: | 8.1.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-08-27 16:15:25 UTC; casto |
| Author: | Peter Biber |
| Maintainer: | Peter Biber <peter.biber@lwf.bayern.de> |
| Repository: | CRAN |
| Date/Publication: | 2026-09-09 15:00:10 UTC |
Require a Complete Stand Age for an Age-Based Increment Estimate
Description
Two of FeNEU's three increment strands - the yield-table estimate and the
gnfi3 (BWI 3) estimate - are driven by stand age: they age a tree forward (or
backward) and take the difference. A tree without an age simply yields
NA there, and because the aggregation drops NAs, the resulting
table looks complete while silently covering only part of the collective.
Rather than let that happen, the affected functions stop.
Usage
.assert_age_complete(x, fn_name)
Arguments
x |
A trees data frame. |
fn_name |
Calling function name, used in the error message. |
Details
The check runs on the collective the calling function actually evaluates (after its own layer / removal filtering), so an inventory whose understorey lacks ages can still be evaluated for the main stand.
Value
x, invisibly and unchanged, when every tree carries an age.
Require an explicit output directory
Description
The raw->pre converters write files, so they must be told where. Earlier
versions defaulted to the raw-data folder, which writes into the user's own
filespace – not permitted by CRAN policy, and against the package's
principle of never guessing silently. output_dir is therefore a
mandatory argument, and this helper turns the bare "argument missing" into a
message that says what to pass. Shared by all three raw->pre converters so
they stay symmetric.
Usage
.assert_output_dir(output_dir, fn)
Arguments
output_dir |
The caller's |
fn |
Name of the calling function, for the error message. |
Value
Invisibly TRUE; called for the error it raises.
Reconstruct the Numeric Breaks of a Factor Produced by cut()
Description
Levels generated by cut read "(a,b]", so the break
vector can be read back off them. Used to classify an aggregated value with
exactly the breaks the incoming tree data were classified with, instead of
guessing an interval that might differ from the caller's.
Usage
.breaks_from_cut_levels(f)
Arguments
f |
An ordered factor as produced by |
Value
A numeric vector of breaks, or NULL if the levels do not have
the expected shape.
File-Name Tag for an Increment Table's Tree Collective
Description
Derives the file-name fragment identifying which tree collective an increment
table describes, from the collective descriptor the increment pipeline
carries along (see .collective_from_filter). The standard kinds
("main_stand", "all_layers") are already file-safe and are used
as they are; a "custom" collective is tagged with its sanitised
definition (the tree-filter expression) rather than the bare word
"custom", so that two PDFs built from different user-defined filters do
not overwrite each other. This mirrors what .table_pdf_meta does for
the base and structure tables.
Usage
.collective_file_tag(collective)
Arguments
collective |
A collective descriptor list with |
Value
A length-one character, safe to embed in a file name.
Convert plot-centre coordinates to a metric CRS for the pre files
Description
The BaySF-style pre columns are named gauss_rw/gauss_hw but, by
convention, carry a projected metric CRS – real BaySF exports store
UTM32 there (the “gauss” name is a legacy misnomer; verified on native
FDINVKRS files, whose GAUSS_RW/GAUSS_HW hold UTM32 and whose
GAUSS_KZ zone field is unreliable). FeNEU follows that convention when
it writes a pre: geographic input (lonlat / ETRS89-geographic)
is reprojected to UTM32 (EPSG:25832, ETRS89 / UTM zone 32N) so a pre file
never holds degrees in a gauss_* column, while already-projected input
(gk*, utm*) is passed through unchanged. The returned
coord_sys describes the returned coordinates and is what the converter
writes into the pre's coord_sys column, keeping the pre
self-describing.
Usage
.coords_to_pre_metric(x, y, coord_sys)
Arguments
x, y |
Numeric plot-centre coordinates in the CRS named by
|
coord_sys |
FeNEU CRS key of the input coordinates. |
Value
list(x, y, coord_sys): the (possibly reprojected) coordinates
and the key of their CRS.
Resolve the inventory year for a raw-to-pre conversion
Description
Downstream only the survey year is used: each plot object carries a
single time_yr, and fe_inventory() validates that a plot covers
one survey year. The converters therefore need a year, not a full date.
Usage
.derive_inventory_year(date_vec, inventory_year = NULL)
Arguments
date_vec |
Character vector of per-plot dates from the file, or
|
inventory_year |
Optional single year overriding the file dates. |
Details
An explicit inventory_year always wins, and the file dates are then not
parsed at all. Otherwise the year is taken as the plain calendar year of the
per-plot file date. If neither an inventory_year nor a usable file date
is available, the caller must stop and ask for inventory_year.
The vegetation-period convention (a survey in, e.g., April counts for the
previous growing season) is deliberately not applied automatically –
that is a silvicultural judgement the user expresses through
inventory_year, not a hidden cut-off inside the importer.
Value
A list list(ok, years, key, arg). On success ok = TRUE
and years is either a single year (override) or one year per element
of date_vec. On failure ok = FALSE and key names the
i18n message to report (with optional arg).
Detect the character encoding of a text file
Description
Returns the encoding of a source text file without the user having to know
it. The detection is deterministic for the only distinction that occurs in
practice for this package's German-language forestry exports – UTF-8 vs.
Latin-1/Windows-1252 – because valid UTF-8 is a self-identifying byte
pattern: a Latin-1 file with umlauts (e.g. a lone 0xE4 for "ä") is
almost never a valid UTF-8 byte sequence. A byte-order mark (BOM) is honoured
when present.
Usage
.detect_file_encoding(path)
Arguments
path |
Path to the file (character). |
Details
Logic: (1) an UTF-8 BOM -> "UTF-8"; a UTF-16 BOM -> "UTF-16";
(2) otherwise, if the raw bytes form valid UTF-8 -> "UTF-8";
(3) otherwise "windows-1252" (a superset of ISO-8859-1 that also
covers the few CP1252 punctuation bytes, harmless for umlaut data).
Not covered: UTF-16 without a BOM (extremely rare for these exports); such a file would be mis-read and is treated as an input error elsewhere.
Value
A single encoding string usable in readr::locale(encoding=).
Drop trees that need a position but do not have one
Description
The BaySF-style pre format needs no tree coordinates for trees of the
innermost concentric circle: those are tallied as a group rather
than located individually, so a missing azimuth / distance is legitimate and
they are kept (with NA coordinates). Every larger tree does
need a position – without one it cannot be placed on its circle and would be
meaningless downstream.
Usage
.drop_trees_without_coords(normalised_trees, second_circle_dbh_cm)
Arguments
normalised_trees |
Tree data after normalisation: |
second_circle_dbh_cm |
Lower DBH bound (cm) of the second circle, i.e.
the threshold at or above which a position is required. |
Details
Such trees are excluded rather than treated as a fatal error, so a user with not-yet-complete data can carry on working; the caller is expected to surface the returned message prominently (report and console), as the excluded trees take part in no evaluation.
The DBH limit is not hard-coded: it is the lower DBH bound of the second circle, i.e. it follows the circle definition of the actual inventory. With only one circle every tree is an innermost-circle tree, so nothing is dropped.
Both concentric raw formats normalise to the same column names before this
runs (koord, bhd in cm, pol_wink, pol_entf),
which is what lets Format 1 and Format 2 share this helper and stay
symmetric.
Value
list(trees, msg): the (possibly reduced) tree data, and either
NULL or a ready-to-emit warning message naming the count, the
threshold and the affected inventory points.
Drop trees that carry no stand-layer code (with an identifiable report)
Description
Every living tree must be assigned to a stand layer – it is what places the
tree in the main stand, the understorey, etc. A raw file may leave the layer
blank for an individual tree (empty layer / bestku); such a
tree ends up with best_ku = NA after normalisation, which
ForestElementsR::fe_ccircle_spatial() later rejects with the cryptic
“column(s) layer_key must be complete”, aborting the whole import over
a single defective tree. FeNEU cannot guess the layer, so – exactly like a
tree without a required position – the tree is excluded (not a
fatal error, so the rest of the intact plot and inventory still build), and
reported identifiably so the user can add the missing code and re-import.
Dead trees always carry best_ku = -1 (set during normalisation), so
only living trees with a genuinely missing layer are affected. Both
concentric raw formats normalise the layer to the same best_ku column,
which lets Format 1 and Format 2 share this helper and stay symmetric.
Usage
.drop_trees_without_layer(normalised_trees)
Arguments
normalised_trees |
Tree data after normalisation: |
Value
list(trees, msg): the (possibly reduced) tree data, and either
NULL or a ready-to-emit warning message naming the affected trees.
Aggregate Per-Tree gnfi3 Increments to the Inventory Level
Description
Shared aggregation core for the single-inventory gnfi3 increment. Takes a
per-tree frame that already carries iv_hub_m3_ha_yr (the tree's
increment scaled to a per-hectare contribution) and aggregates it to the
level of the whole inventory, overall and by species group.
Usage
.gnfi3_overview_core(trees_with_iv, area_info, fill_label)
Arguments
trees_with_iv |
Per-tree frame with at least |
area_info |
One row per inventory plot, with |
fill_label |
Value written into the |
Details
Plots without trees of a given species group enter with an increment of zero in the numerator but with their full area in the denominator, so the species groups sum to the overall value.
Confidence intervals are deliberately NA throughout: a gnfi3 estimate
carries no empirical between-plot variation of a measured increment.
The columns exist so that the result is structurally identical to the
corresponding block of the repeated-survey overview.
Value
A list with the elements overall and
by_species_group, structured exactly like one collective block of
inv_inc_big_overview.
Take the Per-Tree Frame Out of an Increment Bundle
Description
The class-table functions work on a per-tree increment frame. They accept
either that frame directly or one of the bundles that carry it – the result
of inv_increment_repeated_survey or of
inv_increment_gnfi3, both of class fe_increment.
Usage
.increment_bundle_trees(x, fn_name)
Arguments
x |
The object passed by the caller. |
fn_name |
Name of the calling function, for the error message. |
Details
Not every fe_increment object holds trees: the yield-table strand
estimates at stand level and has no per-tree increment at all. Such an object
is refused here with a pointer to the function that does fit, rather than
failing later on a missing column.
Value
A per-tree increment data frame, with its inc_meta attribute
intact.
File-Name Tag for an Increment Table's Method
Description
Derives the file-name fragment identifying which of the three increment strands a base table came from. Without it the three strands collide: the file name is built from the table title, the tree collective and the class axis, all three of which a repeated-survey, a gnfi3 and a yield-table table of the same enterprise share. The rendered PDFs are distinguishable (their subtitle names the method) – only the file names were not, so the last one rendered silently replaced the others.
Usage
.increment_method_tag(meta)
Arguments
meta |
The header meta list carried on an increment output table (its
|
Details
The tag is read from the source element of the header meta the
pipeline already carries: inv_inc_tree_extend_single stamps
"gnfi3" and increment_ytables_base_table stamps
"ytable". The repeated survey sets no source – it is the
reference case and keeps its file name unchanged, so PDFs and scripts that
already exist do not shift.
Value
A length-one character: the sanitised method tag, or "" for the
repeated survey (and whenever no source is recorded). Callers append it with
a separator only when it is non-empty.
Reject inventory points without plot-centre coordinates
Description
Every concentric sample plot is built around its centre coordinate – the
whole circle geometry (and every tree position derived from it) hangs off
that one point. A plot whose centre coordinate is empty cannot be placed and
must not travel into the pre files, where it would otherwise surface much
later as a cryptic “missing values in coordinates not allowed” error
from sf when the pre reader turns the centre into a geometry. Catching
it here, at the raw->pre stage, turns that into a clear, early failure.
Called after the coordinate columns have been parsed to numeric (so an empty
cell is already NA). Shared by both concentric raw->pre converters so
they stay symmetric.
Usage
.missing_coords_msg(points, x_col, y_col, id_col, filename)
Arguments
points |
Inventory-point data frame with numeric coordinate columns. |
x_col, y_col |
Names of the plot-centre coordinate columns. |
id_col |
Name of the plot-identifier column ( |
filename |
The point file name, for the error message. |
Value
NULL when every plot has both coordinates, otherwise a
ready-to-emit error message naming the affected plots.
Null incomplete positions of innermost-circle trees (with an identifiable report)
Description
Innermost-circle trees (dbh below the second circle) need no position. A raw
file may nonetheless give such a tree only PART of a position – a distance
but no azimuth, or vice versa. A half-position is unusable and, left in
place, makes ForestElementsR::fe_ccircle_spatial() build an NA
geometry that sf rejects with “missing values in coordinates not
allowed”, aborting the import. This nulls both components so the
tree is treated as unpositioned (it stays in the evaluation – count / volume
– but is not placed spatially), and returns an identifiable report of the
affected trees. Trees that DO require a position were already handled by
.drop_trees_without_coords, which is why only innermost trees
remain here. Shared by both concentric raw->pre converters so they stay
symmetric; make_object_lists() nulls the same case again as a safety
net for pre files supplied directly (not produced by these converters).
Usage
.null_partial_positions(normalised_trees, second_circle_dbh_cm)
Arguments
normalised_trees |
Tree data after normalisation: |
second_circle_dbh_cm |
Lower DBH bound (cm) of the second circle.
|
Value
list(trees, msg): the tree data with incomplete positions
nulled, and either NULL or a ready-to-emit warning message naming
the affected trees.
Parse selected columns of a raw/pre import table as numbers
Description
Decimal-mark-tolerant numeric parsing for exactly the columns a reader
actually consumes. Only the columns named in cols are touched (via
.parse_numeric_vec); every other column is passed through
unchanged. This is deliberately a whitelist: a raw or pre file that comes
from outside may carry extra, optional, or free-text columns FeNEU does not
use – those ride through untouched, and legitimate commas in text fields are
never harmed (unlike the older df-global convert_numbers_with_commas).
Usage
.parse_numeric_cols(df, cols)
Arguments
df |
A data frame just read from a raw or pre import file. |
cols |
Character vector of canonical column names expected to hold numbers. |
Details
Column names in cols that are not present in df are silently
skipped, so an optional numeric column that a given file happens to omit is
no problem. Identifier columns (plot / stand / tree keys) must NOT be listed
here: they are kept as character and guarded separately (see
.assert_id_cols_integer()).
cols is expected to hold canonical column names, so the call belongs
after any header normalisation / alias renaming has run. The canonical
numeric-column sets are defined per format next to the alias maps in
R/import_column_standards.R, so a format change is a single-file edit.
Value
df with the targeted character columns converted to numeric.
Parse one vector as numbers, tolerant of the decimal mark
Description
Locale-agnostic numeric parsing for a single column. Accepts both point
decimals ("1.69") and German comma decimals ("1,69") as well as
plain integers, so a file exported on a German-locale system and one exported
on an English-locale system yield the same numbers. A value that already
parses as a plain point-decimal number is taken as is; a pure comma-decimal
value has its comma turned into a point and is then parsed. Empty strings and
NA become NA.
Usage
.parse_numeric_vec(x, col_label = NULL)
Arguments
x |
A vector (character or already numeric) from a column that is expected to hold numbers. |
col_label |
Column name used in the warning message (character or
|
Details
Anything else – free text, a thousands separator, scientific notation, mixed
punctuation – is returned as NA and reported with a warning: a
measurement column should not contain such tokens, and turning them into
NA silently would hide a data problem. A vector that is already
numeric is returned unchanged.
Value
A numeric vector the same length as x.
Reject a duplicated plot identifier in the inventory-point file
Description
The plot-identifier column of the inventory-point file (koord in
Format 2, plot_id in Format 1) must be unique – it is THE key that
links a plot to its trees, its coordinates and its circle definition. A
duplicate is never harmless: the pre reader nests each plot's circle
definition by that key, so two rows sharing an id silently collapse into one
plot carrying both circle sets, which only surfaces much later as the cryptic
“dbh_lower is not unique” error. Catching it here, at the raw->pre
stage, turns that into a clear, early failure. Shared by both concentric
raw->pre converters so they stay symmetric.
Usage
.plot_id_duplicate_msg(points, id_col, filename)
Arguments
points |
Inventory-point data frame. |
id_col |
Name of the plot-identifier column ( |
filename |
The point file name, for the error message. |
Value
NULL when the identifier is unique, otherwise a ready-to-emit
error message naming the duplicated ids.
Read a delimited text file with automatic encoding detection
Description
The single entry point every raw/pre reader in this package uses to read a
delimited text file, so that character encoding is handled uniformly and
users never have to choose one. With encoding = "auto" (the default)
the encoding is detected via .detect_file_encoding; any other
value is passed through as an explicit override for pathological cases.
Usage
.read_delim_auto(
file,
delim = "\t",
encoding = "auto",
decimal_mark = ".",
as_text = FALSE,
...
)
Arguments
file |
Path to the file (character). |
delim |
Field delimiter. Default tab. |
encoding |
|
decimal_mark |
Decimal mark for numeric columns. Default |
as_text |
If |
... |
Passed to |
Details
Project convention: do not call readr::read_delim() (or set a
fixed locale(encoding = )) directly in a reader. Route every text-file
read through this helper and expose an encoding = "auto" argument on
the reader so the override is available. This keeps encoding handling in one
place and consistent across all import functions.
Value
A tibble, as returned by readr::read_delim().
Sanitise a String for Use in a File Name
Description
Turns an arbitrary string - a user-supplied table title, a plot identifier, or
a captured tree_filter expression - into a compact, file-name-safe
token: runs of characters outside [A-Za-z0-9.] collapse to single
underscores, and leading or trailing dots and underscores are trimmed.
Usage
.safe_filename_part(s, empty = "x")
Arguments
s |
A length-one character. |
empty |
A length-one character used when |
Details
Dots are kept inside the token on purpose, because plot identifiers are
commonly dotted (900000002.1.99900002) and should stay recognisable in
the file name. Only a leading dot is removed - it would make the rendered PDF
a hidden file on unix-alikes - along with a trailing one, which Windows does
not accept in a file name.
This is the single sanitiser used by all *_pdf() functions, so the
rendered file names follow one convention across the table families.
Value
A length-one character, safe to embed in a file name.
Build the species-guessing mapping report
Description
Summarises how each raw species abbreviation was resolved during
check_and_guess_species: one row per distinct (normalised) raw
abbreviation with its tree count, the canonical abbreviation it maps to, the
resulting species_id/name_ger, and a tier of either
"confirmed" (exact or case-insensitive match) or "review"
(resolved only by substring / fuzzy / mojibake matching, so worth a manual
check). Rows are ordered review-first, then by descending tree count.
Usage
.species_map_report(work_raw, rev_map, species_table)
Arguments
work_raw |
Character vector of per-row normalised raw abbreviations. |
rev_map |
Named character vector mapping review-tier raw abbreviations to their guessed canonical abbreviation (empty when nothing needed the fuzzy tiers). |
species_table |
The standard species table (must carry
|
Value
A tibble with columns raw, n_trees, canonical,
species_id, name_ger, tier.
Derive Renderer Meta-Information from an Output Table
Description
Reads the self-describing attributes an output base/structure table carries
(class_type and tree_selection, stamped by
output_base_table / output_structure_table) and
turns them into everything the *_pdf() functions need without a
user-supplied type or layer_filter argument.
Usage
.table_pdf_meta(x, fn_name)
Arguments
x |
An output base or structure table. |
fn_name |
Calling function name, used only in the error message. |
Value
A list with type ("age"/"dq"), cohort
(the raw tree-selection tag: "mainstand", "alllayers", or a
raw tree_filter expression), and file_tag (the cohort in a
file-name-safe form).
Compact per-tree identifier list for report messages
Description
When FeNEU excludes or alters individual trees (missing position, partial
position, ...), the report must let the user find those trees in their OWN
raw data. A per-plot identifier is not enough – a plot has many trees. This
builds a compact, per-plot listing that names each affected tree by its tree
number when the raw file supplied one (baumnummer / tree_nr,
both optional under the grouping taxonomy) and otherwise by its dbh
(cm) – so the trees stay identifiable even without tree numbers. The format
is symbolic and language-neutral ("<plot>: <dbh>, <dbh>; <plot>:
#<nr>(<dbh>)"); the surrounding message text explains it.
Usage
.tree_ident_label(trees, plot_col = "koord")
Arguments
trees |
Affected-tree subset with at least |
plot_col |
Name of the plot-identifier column (default |
Value
A single character string.
Warn When Structure Table Input Shows No Concentric-Circle Structure
Description
Structure tables break an inventory down by single-tree diameter class within age or dq classes. That is worth doing for a sample inventory, where the diameter distribution is estimated from a sample of trees; for a standwise inventory the same table can be computed but says much less. Nothing is refused here - the table is produced either way - the caller is only told what the data look like.
Usage
.warn_if_not_sample_inventory(inv_trees_plus, fn_name)
Arguments
inv_trees_plus |
A tree list as passed to a |
fn_name |
Calling function name, used only in the message. |
Details
What can actually be observed is dbh_trshld: pull_trees
fills that column with each tree's concentric-circle threshold if - and only
if - the plot is an fe_ccircle_spatial, and leaves it NA
otherwise. An all-NA column therefore means "no concentric-circle
structure in these data", which today implies a standwise inventory but will
not stay equivalent to it: a sample inventory taken by relascope would look
exactly the same here while being a perfectly legitimate case. That is why
this is a warning naming the observation, not a rule refusing a combination -
the wording has to survive the day FeNEU supports more (type x method)
pairs. Deciding it properly needs the inventory type declared on the
fe_inventory object and carried down; that is a post-CRAN item
recorded in CLAUDE.md. An attribute cannot do the carrying, incidentally -
measured: group_by() plus ungroup() already drops one, and the
aggregation code groups constantly.
Value
Invisibly TRUE; called for the warning it may raise.
Species-Group Overview From the Per-Cohort Yield-Table Increments
Description
Aggregates the cohort-level estimate (plot_agg_for_yt followed
by apply_ytables) to one row per species group plus a total
row. All volume figures are harvested volume under bark (Erntefestmeter ohne
Rinde); the collective is the main stand, because yield-table species areas
are only formed there.
Usage
.ytables_overview_from_cohorts(cohorts, plot_area_weight = TRUE, fe_inv = NULL)
Arguments
cohorts |
Per-cohort estimate, one row per inventory plot and species. |
plot_area_weight |
Logical, if TRUE (default), cohorts are weighted with the ideal area they represent; if FALSE all count equally. |
fe_inv |
Optional |
Value
A tibble with one row per species group, an optional
is_no_main_stand_row, and a total row whose site_index is
NA because the index scales differ between yield tables.
Calculate ha-wise Increments per Species Group and Age Class on Inventory Level
Description
Aggregates the plot level output of ha_inc_main_stand_age_class
to the level of the whole inventory
Usage
agg_ha_inc_main_stand_age_class(x, plot_area_weight)
Arguments
x |
A data frame with per-plot increment values, typically the output
of |
plot_area_weight |
Logical, if TRUE (default), the single plots are weighted with the area they represent. If FALSE all plots are equally weighted |
Value
A data frame which is an aggregation of the input x to the
inventory level
Aggregate Yield Table Increments From Plot Level to Inventory Level
Description
Aggregate Yield Table Increments From Plot Level to Inventory Level
Usage
agg_ha_yt_inc_main_stand_age_class(x, plot_area_weight)
Arguments
x |
Output of apply_ytables() |
plot_area_weight |
Logical, if TRUE, the single plots are weighted with the area they represent. If FALSE all plots are equally weighted |
Value
A data frame (tibble) with the grouping variables
species_group, and age_class. For each so-defined group the
tibble provides the area/ha, the average site index, and the yield table
average increments per year and ha.
Apply the Selected Yield Tables on Plot Level
Description
Apply the Selected Yield Tables on Plot Level
Usage
apply_ytables(x, ytable_selection)
Arguments
x |
A data frame, the output of |
ytable_selection |
A data frame assigning yield table names to species
groups; typically produced by |
Value
An extended version of the input x, containing yield table
names, site index, stocking level and yield table increments. The
increment iv_hub_m3_ha_yr_yt is the table's unreduced periodic
annual increment (pai_m3_ha_yr, Vorratsfestmeter mit Rinde),
corrected by the stocking level and then reduced exactly once to harvested
volume under bark (Erntefestmeter ohne Rinde) via
v_red_harvest_ubark. The pre-reduced
red_pai_m3_ha_yr is not used, because it is not guaranteed to be
present in every yield table.
Create a Background Table for All Mean Diameter Class Based Evaluations From an Inventory Tree Data Frame
Description
Calculates the quadratic mean diameter on the nested levels of layer in species group in plot, attributes these values to categories which are the basis for further aggregation with other functions. The function was designed for producing often required information only once.
Usage
back_table_dclass(inv_trees_plus, d_q_interval = 10)
Arguments
inv_trees_plus |
Data frame which covers trees from an inventory (each
row is a tree), typically obtained from an |
d_q_interval |
Integer indicating the interval breaks for the d_q
(quadratic mean diameter) classes to be formed. The breaks are internally
handed over to |
Value
A data frame which reports for each plot, species group and layer the actual quadratic mean diameter and the d_q-class (as an ordered factor) it belongs to.
Examples
# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it.
data_ex3_sample_trees_essentials |>
back_table_dclass()
Species Group Information Table by Age Class
Description
Inventory tree data are grouped by species group and age class. A data frame with group-wise aggregated inventory information is returned.
Usage
base_table_age_class(inv_trees_plus, tree_filter = !.data$removal)
Arguments
inv_trees_plus |
Data frame which covers trees from an inventory (each
row is a tree), typically obtained from an |
tree_filter |
Expression describing which trees to use in the function,
internally passed to |
Value
A list containing four data frames. The first one, called detail
contains the aggregated information by species group and
age class. The second one, total is aggregated on species level, i.e. one
level higher. These values are mostly sums, but not in all cases.
Confidence intervals must be calculated differently and also
n_plot in total will not always be the sum of the values in
detail, as there might be plots which contain two layers with different
d_q classes. The third data frame, all_species, holds the cross-species
aggregation by age class (the body of the "Summe" block of the base table
(Basistabelle)); the fourth, all_total, is the grand total across all species and
all classes.
Attached attribute
The returned list carries a tree_selection attribute recording which
tree cohort it represents: "mainstand" for the *_main_stand()
functions, "alllayers" for the general functions called with their
default tree_filter, or the raw tree_filter expression for a
custom filter. output_base_table /
output_structure_table carry this attribute through to their
own output, where the *_pdf() renderers read it for a
self-describing file name and the cohort disclaimer.
See Also
Other inventory tables:
base_table_age_class_main_stand(),
base_table_d_q_class(),
base_table_d_q_class_main_stand(),
output_base_table(),
output_increment_overall(),
output_structure_table(),
structure_table_age_class(),
structure_table_age_class_main_stand(),
structure_table_d_q_class(),
structure_table_d_q_class_main_stand()
Examples
# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it.
data_ex3_sample_trees_essentials |>
base_table_age_class()
Species Group Information Table by Age Class For the Main Stand Cohort
Description
Species Group Information Table by Age Class For the Main Stand Cohort
Usage
base_table_age_class_main_stand(inv_trees_plus)
Arguments
inv_trees_plus |
Data frame which covers trees from an inventory (each
row is a tree), typically obtained from an |
Value
A list containing four data frames, similar as the output from
base_table_age_class, however restricted to the main stand,
but with information about the areas covered by species (sub-groups).
The first data frame in the list, called detail contains the aggregated
information by species group and age class. The second one, total is
aggregated on species level, i.e. one level higher. These values are mostly
sums, but not in all cases. Confidence intervals must be calculated
differently. The third data frame, all_species, holds the cross-species
aggregation by age class (the body of the "Summe" block of the base table
(Basistabelle)); the fourth, all_total, is the grand total across all species and
all classes.
Attached attribute
The returned list carries a tree_selection attribute recording which
tree cohort it represents: "mainstand" for the *_main_stand()
functions, "alllayers" for the general functions called with their
default tree_filter, or the raw tree_filter expression for a
custom filter. output_base_table /
output_structure_table carry this attribute through to their
own output, where the *_pdf() renderers read it for a
self-describing file name and the cohort disclaimer.
See Also
Other inventory tables:
base_table_age_class(),
base_table_d_q_class(),
base_table_d_q_class_main_stand(),
output_base_table(),
output_increment_overall(),
output_structure_table(),
structure_table_age_class(),
structure_table_age_class_main_stand(),
structure_table_d_q_class(),
structure_table_d_q_class_main_stand()
Examples
# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it.
data_ex3_sample_trees_essentials |>
base_table_age_class_main_stand()
Species Group Information Table by Mean Diameter Class
Description
Inventory tree data are grouped by species group and mean diameter class. A data frame with group-wise aggregated inventory information is returned.
Usage
base_table_d_q_class(inv_trees_plus, dclass_back, tree_filter = !.data$removal)
Arguments
inv_trees_plus |
Data frame which covers trees from an inventory (each
row is a tree), typically obtained from an |
dclass_back |
Data frame listing quadratic mean diameter classes per
species group and layer on plot level. Typically the output of
|
tree_filter |
Expression describing which trees to use in the function,
internally passed to |
Value
A list containing four data frames. The first one, called detail
contains the aggregated information by
species group and mean diameter class. The second data frame, total is
aggregated on species level, i.e. one level higher. These values are mostly
sums, but not in all cases. Confidence intervals must be calculated
differently and also n_plot in total will not always be the sum of
the values in detail, as there might be plots which contain two layers
with different d_q classes. The third data frame, all_species, holds the
cross-species aggregation by mean diameter class (the body of the "Summe"
block of the base table (Basistabelle)); the fourth, all_total, is the grand total
across all species and all classes.
Attached attribute
The returned list carries a tree_selection attribute recording which
tree cohort it represents: "mainstand" for the *_main_stand()
functions, "alllayers" for the general functions called with their
default tree_filter, or the raw tree_filter expression for a
custom filter. output_base_table /
output_structure_table carry this attribute through to their
own output, where the *_pdf() renderers read it for a
self-describing file name and the cohort disclaimer.
See Also
Other inventory tables:
base_table_age_class(),
base_table_age_class_main_stand(),
base_table_d_q_class_main_stand(),
output_base_table(),
output_increment_overall(),
output_structure_table(),
structure_table_age_class(),
structure_table_age_class_main_stand(),
structure_table_d_q_class(),
structure_table_d_q_class_main_stand()
Examples
# The prepared tree list is shipped with the package: it is this inventory
# put through pull_trees() -> height_complete_inventory() ->
# fill_heights_back() -> pull_trees() -> trees_add_essentials(). See
# ?data_ex3_trees_essentials for that chain spelled out.
trees_with_heights <- data_ex3_sample_trees_essentials
peg_back_d <- back_table_dclass(trees_with_heights)
base_table_d_q_class(trees_with_heights, dclass_back = peg_back_d)
Species Group Information Table by Mean Diameter Class and Single Tree Diameter Class For the Main Stand Cohort
Description
Very similar aggregation table to the one produced by
base_table_d_q_class, but restricted to to the main stand
(layer_key == 1) only. It contains, however, estimates of areas covered by
species (sub-)groups and ha-related values o these cohorts. Due the
methodological dubiousness of species area calculations in mixed stands, this
is only done for the main stand (comparably to how this was handled in the
3rd German National Forest Inventory).
Usage
base_table_d_q_class_main_stand(inv_trees_plus, dclass_back)
Arguments
inv_trees_plus |
Data frame which covers trees from an inventory (each
row is a tree), typically obtained from an |
dclass_back |
Data frame listing quadratic mean diameter classes per
species group and layer on plot level. Typically the output of
|
Value
A list containing four data frames, similar as the output from
base_table_d_q_class, however restricted to the main stand,
but with information about the areas covered by species (sub-groups).
The first data frame in the list, called detail contains the aggregated
information by species group and mean diameter class. The second one,
total is aggregated on species level, i.e. one level higher. These values
are mostly sums, but not in all cases. Confidence intervals must be
calculated differently. The third data frame, all_species, holds the
cross-species aggregation by mean diameter class (the body of the "Summe"
block of the base table (Basistabelle)); the fourth, all_total, is the grand total
across all species and all classes.
Attached attribute
The returned list carries a tree_selection attribute recording which
tree cohort it represents: "mainstand" for the *_main_stand()
functions, "alllayers" for the general functions called with their
default tree_filter, or the raw tree_filter expression for a
custom filter. output_base_table /
output_structure_table carry this attribute through to their
own output, where the *_pdf() renderers read it for a
self-describing file name and the cohort disclaimer.
See Also
Other inventory tables:
base_table_age_class(),
base_table_age_class_main_stand(),
base_table_d_q_class(),
output_base_table(),
output_increment_overall(),
output_structure_table(),
structure_table_age_class(),
structure_table_age_class_main_stand(),
structure_table_d_q_class(),
structure_table_d_q_class_main_stand()
Examples
# The prepared tree list is shipped with the package: it is this inventory
# put through pull_trees() -> height_complete_inventory() ->
# fill_heights_back() -> pull_trees() -> trees_add_essentials(). See
# ?data_ex3_trees_essentials for that chain spelled out.
trees_with_heights <- data_ex3_sample_trees_essentials
peg_back_d <- back_table_dclass(trees_with_heights)
base_table_d_q_class_main_stand(
trees_with_heights, dclass_back = peg_back_d
)
Build fcbestku (standard BaySF layer definition)
Description
Returns the standard BaySF layer code table. This default is used whenever
no external layers_filename is supplied to the orchestrator.
Usage
build_fcbestku()
Value
Data frame ready to be written as fcbestku.txt.
Build fdinvba from normalised tree data
Description
Build fdinvba from normalised tree data
Usage
build_fdinvba(normalised_trees)
Arguments
normalised_trees |
Tibble with common normalised columns. |
Value
Tibble ready to be written as fdinvba.txt.
Build fdinvbhd from normalised tree data
Description
Build fdinvbhd from normalised tree data
Usage
build_fdinvbhd(normalised_trees)
Arguments
normalised_trees |
Tibble with common normalised columns (see file header for required column names). |
Value
Tibble ready to be written as fdinvbhd.txt.
Build fdinvkrs from normalised inventory-point data
Description
Build fdinvkrs from normalised inventory-point data
Usage
build_fdinvkrs(normalised_points)
Arguments
normalised_points |
Tibble with common normalised columns:
|
Value
Tibble ready to be written as fdinvkrs.txt.
Build fdinvtot from normalised deadwood data
Description
Converts normalised deadwood measurements into the fdinvtot format
used by the BaySF processing chain. Per BaySF instructions (Erstanlage
2024, §6.2.8), deadwood is always recorded on a fixed 500 m² circle
(radius 12.62 m), independent of the live-tree concentric circles.
Usage
build_fdinvtot(normalised_deadwood, source = "inputmask")
Arguments
normalised_deadwood |
Tibble with source-specific columns as described above. |
source |
Character scalar: |
Details
Volume per piece is estimated with a half-cylinder approximation (form factor 0.5):
v_{ha} = 0.5 \cdot \pi \cdot \left(\frac{d_{cm}}{200}\right)^2
\cdot h_m \cdot n_{ha}
Two input sources are supported via the source argument:
"inputmask" (Eingabemaske / input mask app export) — normalised input must
contain:
- koord
Plot identifier.
- lfd_tot
Sequential deadwood piece number within plot.
- totholz_lage
Position code:
"1"= standing,"2"= lying. Standing pieces cannot be distinguished as whole vs. partial stem, so all are mapped tototkat = 91.- totzer
Decomposition grade (integer 1–5).
- totbag
Species group code;
4(Nicht bestimmbar) is recoded to0.- dm
Mid-diameter in mm (converted to cm internally).
- hoehe
Length / height in dm (converted to m internally).
- fe_nr, fe_period, bestkey, bestlfd
Administrative keys.
"concentric" (Kraus / concentric-circle survey) — normalised
input must contain:
- koord
Plot identifier.
- lfd_tot
Sequential deadwood piece number within plot.
- kategorie
Position code:
1= stehend ganzer Stamm (totkat = 90),2= stehend Stammteil (totkat = 91),3= liegend (totkat = 92). Any other value is mapped toNAand filtered out.- grad
Decomposition grade (integer 1–3), mapped directly to
totzer.- totbag
Species group code: 1 = Eiche, 2 = Nadelholz, 3 = Laubholz, 4 = nicht zuzuordnen (recoded to 0).
- dm
Mid-diameter in cm (no conversion needed).
- hoehe
Length / height in m (no conversion needed).
- fe_nr, fe_period, bestkey, bestlfd
Administrative keys.
Value
Tibble ready to be written as fdinvtot.txt with columns
fe_period, bestkey, bestlfd, koord,
lfd_tot, totkat, totzer, totbag, dm
(cm), hoehe (m), fe_nr, v_ha, n_ha.
Build fdvikrs (circle definitions)
Description
Returns the standard fdvikrs data frame. When circle_definitions
is NULL (the default), a single circle class (fe_ikl = 1)
is created from bhds_from and radiuses. When
circle_definitions is supplied, it must be a data frame with
columns fe_ikl, bhd_von, and radius, and multiple
circle classes are created.
Usage
build_fdvikrs(bhds_from = NULL, radiuses = NULL, circle_definitions = NULL)
Arguments
bhds_from |
Numeric vector of lower DBH limits per circle.
Ignored when |
radiuses |
Numeric vector of circle radii in metres.
Ignored when |
circle_definitions |
Optional data frame with columns
|
Value
Data frame ready to be written as fdvikrs.txt.
Internal Helper Function for Calculating Tree Volumes at Sampling Thresholds
Description
Required for all tree-increment calculation options in
tree_inc_repsurv, where sampling thresholds have to be taken
into account.
Usage
calc_v_hub_m3_at_thrsh(
tree_matches,
inv_1st,
inv_2nd,
inv_1st_trees,
inv_2nd_trees
)
Check and guess species names
Description
This is a convenience function that helps in the context of inconsistently coded German species name abbreviations. It tries to guess correct species names and connects them to species codes that are supported by the package ForestElementsR. Despite the function applies clever techniques, a manual check ot the outcome is absolutely recommended.
Usage
check_and_guess_species(tree_list, species_table)
Arguments
tree_list |
A data frame containing a column "baumart" which contains the species name abbreviations to be checked. |
species_table |
A data frame containing with the columns "name_ger",
"species_id", and "abbreviation". The first two columns have to come from
a species coding table provided by the package ForestElementsR. The
third column contains the standard abbrevations that the function will try
to guess from the entries in |
Details
Remark by Peter: The current version operates on data frames and requires column naming conventions. A future streamlined version can be more generic and based on named vectors.
Value
A duplicate-free data frame containing all successful matches
Check Circle Definition Compatibility of Matched Inventory Plots
Description
Internal helper called by match_2_inventories. For each matched
plot pair, the circle definitions (columns dbh_lower and c_area)
are compared. Pairs with incompatible circle definitions are removed from
matches and stored in a new list element
circle_def_mismatch. The comparison uses tolerances:
dbh_lower is rounded to 1 decimal place (0.1 cm = 1 mm) and
c_area is rounded to 5 decimal places (0.00001 ha = 0.1 m²).
This accounts for potential rounding artifacts in the data while still
detecting genuine differences in circle setup. Plots with empty circle
definitions (notrees plots) are always considered compatible, because
ingrowth and mortality are handled separately in the increment
calculation.
Usage
check_circle_def_compatibility(match_rslt, inv_a, inv_b)
Arguments
match_rslt |
List as returned by
|
inv_a, inv_b |
|
Value
The input list match_rslt with an additional element
circle_def_mismatch containing the incompatible plot pairs. These
pairs are removed from matches.
Check R Package and System Dependencies for PDF Rendering
Description
Gate function called at the top of every *_pdf() function. Throws an
informative error when rmarkdown, kableExtra, or pandoc is
missing, so users get a clear install message rather than a cryptic
backtrace from inside rmarkdown::render().
Usage
check_pdf_dependencies(fun_name)
Arguments
fun_name |
Character string — the name of the calling |
Value
NULL invisibly when all dependencies are present.
See Also
pdf_dependencies, diagnose_pdf_toolchain
Other pdf_output:
output_base_table_pdf(),
output_increment_base_table_pdf(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
output_structure_table_pdf(),
pdf_dependencies,
plot_info_sheet_pdf()
Examples
# The gate every *_pdf() function calls first: silent when everything is in
# place, an informative error otherwise. Guarded here so that the example
# itself stays harmless on a machine without the toolchain.
if (requireNamespace("kableExtra", quietly = TRUE) &&
rmarkdown::pandoc_available()) {
check_pdf_dependencies("output_base_table_pdf")
}
Checks if Input Data Compise all Necessary Information According to the Bavarian State Forest standards
Description
Checks if Input Data Compise all Necessary Information According to the Bavarian State Forest standards
Usage
check_raw_data_BaySF(raw_data)
Arguments
raw_data |
Input data to be checked, i.e. a list of data frames, each representing one of the standard tables of the Bavarian State Forest inventory data definitions, including the names of the tables. Currently four tables are required, namely fdinvbhd, fdinvba, fdinvkrs, and fdvikrs |
Value
If the check fails, the function terminates with an error. If not, it
returns a list of column name vectors that are required to build an
intermediate inventory list with the function
read_rawdata_BaySF
Check Compatibility of a Yield Table Selection With Given Data
Description
Check Compatibility of a Yield Table Selection With Given Data
Usage
check_ytable_selection_vs_data(inv_dat, ytable_selection)
Arguments
inv_dat |
Inventory data frame (pulled from an
|
ytable_selection |
Yield table selection to be tested against the data;
see documentation of |
Value
A list comprising a flag called success (TRUE if check
result ok, FALSE otherwise), and a character string called
message that contains an error message in case the check is not
successful
Convert numbers with commas to point format
Description
Helper function for handling input data generated on German systems.
Usage
convert_numbers_with_commas(df)
Arguments
df |
A data frame containing numbers with commas |
Details
Remark by Peter: Operates on a data frame. Future versions could be more simple and generic by just taking one vector as the input; the current version would also replace correct commas in text fields. The vector-based version would be called from outside only for those columns of a data frame, that are intended to be numeric.
Value
A data frame similar to the input, however with all commas replaced by points and all colums converted to numeric if possible
Count inventory points by regeneration plants per point (long format)
Description
Usage
count_reg_points_by_plants_long(
inv_dat_trees_ext_reg,
mixture_per_plot,
pulled_circles
)
Arguments
inv_dat_trees_ext_reg |
Tibble from |
mixture_per_plot |
Tibble with |
pulled_circles |
Tibble of circle definitions with |
Details
Counts the number of inventory points ("Probkreise") by classes of plant numbers per point, analogous to the "Zahl der Probkreise nach Pflanzenzahl je Probekreis" block in L43.
For each mixture_class × species_group, the function:
approximates the counted plants (
tree_count) per inventory point,sums plants per point across all regeneration trees on that point,
assigns each point to a plant-number class (e.g. 0, 1-9, 10-19, ...),
counts how many points fall into each class.
An additional "total" block aggregates across all mixture classes per species.
Value
Tibble with one row per mixture_class × species_group × plant_count_class (plus an overall "total" block), containing:
- mixture_class
Mixture block ("total" or specific mixture)
- species_group
Species identifier
- plant_count_class
Class of plants per point (character)
- n_inv_points
Number of inventory points in this class
Example raw sample inventory tables (Format 1, 10 inventory points)
Description
Artificial but realistic raw forest inventory tables (tree, plot and
regeneration) in FeNEU's raw data Format 1 for sample
inventories with concentric circles. They describe an inventory of only ten
inventory points. The Gauss-Krueger coordinates in the point table are random
numbers and do not refer to any real location. Only the columns the Format-1
converter consumes are kept (see
import_sample_concentric_format1_raw_to_pre).
Format
- data_ex1_sample_raw_points
Plot table linked by
plot_id.- data_ex1_sample_raw_trees
Tree table linked by
plot_id.- data_ex1_sample_raw_smalltrees
Regeneration table linked by
plot_id.
Source
Internal example data (artificial, Format 1)
See Also
Other example data:
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Example raw inventory tables in BaySF style (forestry-mask format, 10 inventory points)
Description
Artificial but realistic raw forest inventory tables (plot and tree data) in
FeNEU's raw data format 2 for sample inventories. They describe an
inventory in the style of the Bavarian State Forest Enterprise (BaySF),
comprising only ten inventory points. Any stored coordinates are random
numbers and do not refer to any real location.
Format
- data_ex2_sample_raw_points
Plot table linked by
koord.- data_ex2_sample_raw_trees
Tree table linked by
koord.
Source
Internal example data (artificial, BaySF style)
See Also
Other example data:
data_ex1_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Interim Increment Stages of the ex3 Inventory Pair
Description
The repeated-survey increment runs through several steps, each of them an exported function with its own help page. The first two steps are shipped here as ready-made objects, so that the examples of the later steps can start at their own subject instead of rebuilding the chain that leads up to it.
Usage
data_ex3_increment_matched
data_ex3_increment_fills
Format
data_ex3_increment_matched is a list of six elements:
tree_increments (152 rows, 22 columns), plot_matches,
match_plot_stats, match_tree_stats, inv_period and
method ("rep_classic").
data_ex3_increment_fills is a list of five estimate data frames –
fills_forward (31 rows), fills_backward (47),
fills_backward_nomatch (0), fills_backward_implausible (1)
and fills_backward_reptrees (56) – plus inv_period,
plot_matches and method carried through from the matching.
An object of class list of length 6.
An object of class list of length 8.
Details
data_ex3_increment_matched is what matching the two surveys yields:
the per-tree increments derived from the measured data of both
surveys, together with the plot and tree matching statistics and the survey
period.
data_ex3_increment_fills holds the GNFI 3 estimates that stand
ready to fill the gaps the matching leaves – trees found in only one of the
surveys, and trees whose match was flagged implausible. It is not a filled
tree list: which of these estimates is actually used is decided one step
later by inv_inc_tree_consolidate through its
fill_option. Because it was built with include_reptrees = TRUE,
it also carries estimates for trees measured in both surveys, which
have no gap at all; fill_option = "all_estimates" needs those.
Interim data for examples and tests
These objects exist for the documentation and the test suite, not as a
processing stage of their own. They are built in
data-raw/data_ex3_increment_interim.R from the shipped ex3 inventory
pair and its prepared tree lists
(data_ex3_trees_essentials):
data_ex3_increment_matched <- inv_increment_repsurv_ccirc( data_ex3_previous_sample_fe_inventory, data_ex3_sample_fe_inventory, data_ex3_previous_sample_trees_essentials, data_ex3_sample_trees_essentials, match_type = "plot_id", plot_id_style = "baysf" ) data_ex3_increment_fills <- inv_inc_fill_gaps_gnfi3( data_ex3_increment_matched, data_ex3_previous_sample_trees_essentials, data_ex3_sample_trees_essentials, include_reptrees = TRUE )
Those are the settings the examples use throughout. An example that
deliberately shows a different one – another increment method, matching by
centre coordinates, or include_reptrees = FALSE – calls the function
itself, because that difference is its subject. Whenever the increment chain
changes, these objects have to be rebuilt with the script above, just like
the prepared tree lists.
See Also
inv_increment_repsurv_ccirc and
inv_inc_fill_gaps_gnfi3, the functions that produce them;
inv_increment_repeated_survey, which runs the whole chain in
one call and is what most users want.
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Examples
# Start at the consolidation step, without rebuilding what precedes it
inv_inc_tree_consolidate(
data_ex3_increment_fills, fill_option = "standard"
)
Example Inventory Data as an fe_inventory object (10 inventory points, earlier survey)
Description
Example Inventory Data as an fe_inventory object (10 inventory points, earlier survey)
Details
This fe_inventory object holds artificial but
realistic inventory data in the style of the Bavarian State Forest
Enterprise (BaySF). It comprises only ten inventory points and was
generated with fe_inventory from tab-delimited text files.
The stored Gauss-Krueger coordinates are random numbers and do not refer
to any real location. It contains the same inventory points as
data_ex3_sample_fe_inventory and represents the earlier of
two successive surveys (used to demonstrate increment estimation).
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Example Inventory Data as an fe_inventory object (10 inventory points)
Description
Example Inventory Data as an fe_inventory object (10 inventory points)
Details
This fe_inventory object holds artificial but
realistic inventory data in the style of the Bavarian State Forest
Enterprise (BaySF). It comprises only ten inventory points and was
generated with fe_inventory from tab-delimited text files.
The stored Gauss-Krueger coordinates are random numbers and do not refer
to any real location. Five of the ten inventory points carry small-tree
records, five do not.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Prepared Tree Lists of the ex3 Inventory Pair
Description
The tree lists of the two ex3 surveys, ready for analysis: heights complete,
volumes, standing areas and species groups added. They are shipped so that
the increment examples can start from a prepared tree list instead of
repeating the five-step preparation in every single @examples block.
Usage
data_ex3_sample_trees_essentials
data_ex3_previous_sample_trees_essentials
Format
Each a tibble with one row per tree and 23 columns, among them
plot_id, tree_id, species_id, species_group,
age_yr, dbh_cm, height_m, n_rep_ha,
area_rep_ha, layer_key, removal, g_m2,
v_hub_m3 and standing_area_m2.
data_ex3_sample_trees_essentials has 139 rows (second survey),
data_ex3_previous_sample_trees_essentials 112 (first survey).
An object of class tbl_df (inherits from tbl, data.frame) with 139 rows and 23 columns.
An object of class tbl_df (inherits from tbl, data.frame) with 112 rows and 23 columns.
Details
These are not a fourth processing stage of the inventory taxonomy
(raw -> pre -> fe_inventory, see
data_examples_overview).
They sit after the import, on the analysis side: an
fe_inventory object carries the inventory, and pulling and
preparing its trees is the first step of evaluating it.
How they were built
With the canonical chain, spelled out in
data-raw/data_ex3_trees_essentials.R:
trees_with_heights <- inv |> pull_trees() |> height_complete_inventory() inv |> fill_heights_back(trees_with_heights) |> pull_trees() |> trees_add_essentials(method = "BaySF")
The second pull_trees is what makes the chain canonical:
fill_heights_back writes the estimated heights into the
inventory object, so the re-pulled trees carry them in height_m and
none of the estimation helper columns (h_est_m, d_q_cm,
h_q_m) ride along. Folding h_est_m into height_m by hand
instead gives the same increments but a tree list of a different shape –
a difference that has caused real breakage, see inv_inc_tree_extend.
See Also
data_ex3_sample_fe_inventory and
data_ex3_previous_sample_fe_inventory, the inventories they
were pulled from; inv_increment_repeated_survey, the usual
consumer.
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Examples
# What the two objects are
dim(data_ex3_sample_trees_essentials)
dim(data_ex3_previous_sample_trees_essentials)
names(data_ex3_sample_trees_essentials)
# They are ready to use, no preparation needed. The usual consumer is
# inv_increment_repeated_survey(); its help page runs the whole chain on
# exactly this pair, so it is not repeated here.
head(data_ex3_sample_trees_essentials[, c("plot_id", "species_id",
"dbh_cm", "height_m", "v_hub_m3")])
Example Inventory Data as an fe_inventory object (earlier survey)
Description
Example Inventory Data as an fe_inventory object (earlier survey)
Details
This fe_inventory object holds artificial but
realistic inventory data in the style of the Bavarian State Forest
Enterprise (BaySF). It was generated with fe_inventory from
tab-delimited text files. The stored Gauss-Krueger coordinates are random
numbers and do not refer to any real location. It represents the earlier
of two successive surveys and contains the same inventory points as
data_ex4_sample_fe_inventory, except for three points that
were newly established in the later survey; it therefore comprises 97
inventory points.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Example Inventory Data as an fe_inventory object (100 inventory points)
Description
Example Inventory Data as an fe_inventory object (100 inventory points)
Details
This fe_inventory object holds artificial but
realistic inventory data in the style of the Bavarian State Forest
Enterprise (BaySF). It comprises one hundred inventory points and was
generated with fe_inventory from tab-delimited text files.
The stored Gauss-Krueger coordinates are random numbers and do not refer
to any real location.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Simulated Inventory Data for Generic Matching Tests (10 plots, first survey)
Description
Simulated Inventory Data for Generic Matching Tests (10 plots, first survey)
Details
This fe_inventory object was derived from a simulated
forest enterprise (pure spruce, 400 stands, 5 ha each). It contains a
10-plot subsample selected for unique within-plot tree IDs. The original
simulation tree IDs are used as lfd_bhd, making the BaySF tree ID
(paste(lfd_satz, lfd_bhd)) a permanent identifier that is stable
across inventories. This enables testing of tree_id_style = "generic"
(ID-based matching) in inv_increment_repsurv_ccirc.
Seven of the ten plots have both vanished and ingrown trees; three plots
have all trees surviving between surveys. The dataset represents the
first survey (year 2020). See
data_ex5_sample_fe_inventory for the second survey.
Generated by data-raw/simulated_inventory_generic_matching.R.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Simulated Inventory Data for Generic Matching Tests (10 plots, second survey)
Description
Simulated Inventory Data for Generic Matching Tests (10 plots, second survey)
Details
This fe_inventory object represents the second survey
(year 2030) of the same 10 plots as
data_ex5_previous_sample_fe_inventory. See that object's documentation
for details on the data source and the permanent tree ID scheme used for
testing tree_id_style = "generic" matching.
Generated by data-raw/simulated_inventory_generic_matching.R.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Stand-Wise Inventory as an fe_inventory object
Description
Stand-Wise Inventory as an fe_inventory object
Details
This fe_inventory object (fe_stand plots) was
built via the two-stage import chain
(import_standwise_relascope_format1_raw_to_pre +
import_standwise_relascope_pre_to_fe_inventory) from the
raw Silvarith-style example data shipped at
system.file("extdata", "data_ex6_standwise_raw", package = "FeNEU").
It has two fictitious stands and carries no plot coordinates, as is
typical for stand-wise inventories with angle-count
(relascopic, “Winkelzählprobe”) surveys.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Stand-Wise Inventory as an fe_inventory object
Description
Stand-Wise Inventory as an fe_inventory object
Details
This fe_inventory object (fe_stand plots) was
built with import_standwise_relascope_pre_to_fe_inventory
from the pre-processed Silvarith-style example data shipped at
system.file("extdata", "data_ex7_standwise_pre", package = "FeNEU").
It has two fictitious stands and carries no plot coordinates, , as is
typical for stand-wise inventories with angle-count
(relascopic, “Winkelzählprobe”) surveys.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
FeNEU Example Data
Description
FeNEU ships a set of small example inventories used throughout the
documentation, examples and tests. They are fully anonymised and artificial:
plot coordinates are randomised and all identifiers are re-assigned, so the
data carry no reference to any real forest enterprise and must not be used to
draw conclusions about one. The sets are named data_ex1_... to
data_ex7_.... The data represent three different processing stages, and the
inventory types currently supported by FeNEU.
Processing stages
An inventory passes through up to three stages in FeNEU, and each example is provided at whichever stages are useful for demonstration:
- raw
The unprocessed input tables as delivered by the field recording software, before any standardisation. Bundled as text files under
system.file("extdata", ...), which is what the*_raw_to_pre()functions read. For ex1 and ex2, the same tables are additionally bundled asdata/tibbles (data_ex1_*,data_ex2_*) so that they can be inspected without reading a file; the text files are generated from those tibbles (data-raw/), so the two cannot drift apart.- pre (preprocessed)
The intermediate, standardised form the
*_pre_to_fe_inventory()step consumes – BaySF-style tab-delimited text files for the concentric sample type, or a canonicalWZP_Daten.txtfor the stand-wise type. Bundled as folders undersystem.file("extdata", ...).- fe_inventory
The ready-to-analyse fe_inventory object, bundled as a
data/object.
Inventory types
FeNEU supports sample and stand-wise inventories. Currently, we cover sample inventories that follow a concentric circle design, and stand-wise inventories with several angle-count samples per stand. In the overview table below, we refer to these types as sample, and standwise.
- sample (concentric circles)
Sample-point inventory on concentric circles. Two raw input formats exist for sample inventories, "Format 1" and "Format 2"; both feed the same preprocessed BaySF-style form. Scope is counted in inventory points.
- standwise (angle-count / relascope)
Stand-wise inventory in which each stand is sampled with several relascope angle-count (Winkelzaehlprobe) points. Currently, only one raw data format is supported for standwise relascope inventories ("Format 1"); the raw and the preprocessed data follow the Silvarith-style. Scope is counted in stands; in the resulting object every angle-count point becomes one
fe_standrow.
Sample circle geometry
The raw formats of the sample inventories do not carry the geometry of the
concentric circles – it is part of the inventory design, not of the field
records. It therefore has to be passed to the *_raw_to_pre() functions,
through the arguments dbh_cm_from (the lower dbh threshold of each circle,
in cm) and radiuses_m (the matching radii, in m). Getting it wrong scales
the representation factors and hence every per-hectare figure, so the
designs of the two raw example sets are stated here:
| Set | dbh_cm_from | radiuses_m | resulting circle areas |
| ex1 | c(0, 12, 30, 48) | c(2.82, 5.64, 11.28, 17.84) | 25 / 100 / 400 / 1000 m² |
| ex2 | c(0, 12, 30) | c(2, 6.31, 12.62) | 12.6 / 125 / 500 m² |
These are the designs of the inventories the anonymised examples were derived from; use them when running the raw import of ex1 or ex2. The sets bundled from the preprocessed stage onwards (ex3 to ex5) carry their circle definition in the data and need no such argument.
Overview
| Set | Type | Stages bundled | Scope |
| ex1 | sample (concentric) | raw (Format 1) | 10 points |
| ex2 | sample (concentric) | raw (Format 2) | 10 points |
| ex3 | sample (concentric) | pre, fe_inventory (+ previous) | 10 points (previous 9) |
| ex4 | sample (concentric) | pre, fe_inventory (+ previous) | 100 points (previous 95) |
| ex5 | sample (concentric) | pre (simulated), fe_inventory (+ previous) | 10 points (previous 10) |
| ex6 | standwise (relascope) | raw (Format 1), pre, fe_inventory | 2 stands (17 points) |
| ex7 | standwise (relascope) | pre, fe_inventory | 2 stands (15 points) |
Datasets in each set
- ex1 – sample, Format 1, raw
extdata folder
data_ex1_sample_raw(Baumschicht.txt,Inv_punkt.txt,Verjuengung.txt); objectsdata_ex1_sample_raw_trees(133 rows),data_ex1_sample_raw_points(10),data_ex1_sample_raw_smalltrees(43). Circle design:dbh_cm_from = c(0, 12, 30, 48),radiuses_m = c(2.82, 5.64, 11.28, 17.84). A dead-wood table exists for developers only (deadwood import is deferred); it is not shipped with the package.- ex2 – sample, Format 2, raw
extdata folder
data_ex2_sample_raw(02_probekreis.txt,01_root_entity.txt); objectsdata_ex2_sample_raw_trees(177 rows),data_ex2_sample_raw_points(10). Circle design:dbh_cm_from = c(0, 12, 30),radiuses_m = c(2, 6.31, 12.62). A small-tree and a dead-wood table are not bundled yet (see note).- ex3 – sample, concentric
extdata folder
data_ex3_sample_pre; objectsdata_ex3_sample_fe_inventoryanddata_ex3_previous_sample_fe_inventory(an earlier survey of the same points, for increment estimation).- ex4 – sample, concentric
extdata folder
data_ex4_sample_pre; objectsdata_ex4_sample_fe_inventoryanddata_ex4_previous_sample_fe_inventory. Same design as ex3, larger.- ex5 – sample, concentric, simulated
extdata folders
data_ex5_sample_preanddata_ex5_previous_sample_pre; objectsdata_ex5_sample_fe_inventoryanddata_ex5_previous_sample_fe_inventory. Carries permanent tree ids (tree_id_style = "generic").- ex6 – standwise, relascope
extdata folders
data_ex6_standwise_rawanddata_ex6_standwise_pre; objectdata_ex6_standwise_fe_inventory.- ex7 – standwise, relascope
extdata folder
data_ex7_standwise_pre; objectdata_ex7_standwise_fe_inventory.
Derived test fixtures
A few further bundled objects are derived from ex3 and kept under their
historical names; they are not part of the ex1–ex7 scheme and exist for
regression testing: inc_sub10_rep_classic, inc_sub10_rep_mean,
inc_sub10_rep_end, inc_sub10_rep_trans (increment reference results),
processed_pulled_sub10, processed_heights_nfi_sub10 and
processed_heights_bav_sub10 (intermediate tree-preparation results).
Note on the Format-2 example (ex2)
ex2 currently provides only the tree and inventory-point tables. A Format-2 dead-wood table (the "07" sheet) and a regeneration table are not bundled yet; they can be added later.
Stand register (Revierbuch)
Besides the raw -> pre -> fe_inventory chain, FeNEU offers a separate strand
that produces a stand register (Revierbuch) from the inventory input
data. It needs stand-level attributes that an fe_inventory object does not
carry. For stand-wise inventories these are read from a metadata file with
import_standwise_relascope_format1_metadata();
import_standwise_relascope_format1_stand_register_bundle() orchestrates
trees and metadata for stand_register_pdf(). Set ex6 bundles such a
metadata file (stand_metadata.txt) as an example; the three processing
stages above never touch it.
See Also
The exported import functions that move an inventory between the stages illustrated by these example data:
raw to pre:
import_sample_concentric_format1_raw_to_pre(),import_sample_concentric_format2_raw_to_pre(),import_standwise_relascope_format1_raw_to_pre()pre to fe_inventory:
import_sample_concentric_pre_to_fe_inventory(),import_standwise_relascope_pre_to_fe_inventory()the inventory-type-agnostic dispatcher for the pre to fe_inventory step:
read_and_convert_data()the object constructor itself:
fe_inventory()the stand register strand:
import_standwise_relascope_format1_metadata(),import_standwise_relascope_format1_stand_register_bundle(),stand_register_pdf()
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Add Essential Information to Deadwood Data
Description
Adds representative plot area (from an fe_inventory object) and
fixed L46 diameter classes to a deadwood tibble imported from BaySF
fdinvtot. No further transformations are performed; volume and
number per hectare are already provided in the raw file.
Usage
deadwood_add_essentials(deadwood_dat, inventory_plots)
Arguments
deadwood_dat |
Tibble containing deadwood data imported and renamed
from fdinvtot.txt. Must include |
inventory_plots |
Tibble containing plot-level data from an
|
Value
Tibble identical to deadwood_dat but with two additional
variables:
- area_rep_ha
Representative area of the sample plot (ha)
- dclass_46
L46 diameter class (I, II, III)
Detect and validate a uniform date format in a character vector
Description
Attempts to determine the date format used in a character vector containing date strings. A small set of expected formats is tested on a representative non-empty value, and strict round-trip validation is applied. Exactly one format must match; otherwise the function raises an error. This ensures that all imported date fields follow a single, unambiguous, and internally convertible format.
Usage
detect_date_format(date_string)
Arguments
date_string |
A character vector containing date values to be tested. |
Value
A single character string representing the detected date format. If no format or more than one format matches, an informative error is thrown.
Diagnose the PDF Rendering Toolchain
Description
Checks whether the tools required for rendering PDF reports (pandoc and a LaTeX distribution) are available on the current system, and prints a message for each missing component explaining how to install it.
Usage
diagnose_pdf_toolchain()
Value
Invisibly, a named logical list with elements pandoc and
latex.
See Also
Examples
diagnose_pdf_toolchain()
Aggregated hq and dq values from Single Tree to Inventory Level by User Defined Grouping
Description
Workhorse function used to complete heights at inventory level
Usage
dq_hq_perclass(inv_trees_ext, ...)
Arguments
inv_trees_ext |
A tibble representing the trees of an inventory (or any
subset), typically the outbput of |
... |
Grouping variables defining the level of aggregation, internally
passed to |
Value
A tibble containing the aggregated information for dq and hq
Generate a fe_ccircle_spatial Object From an Output
Row of make_inventory_list
Description
Standard users do not need to call this function directly. Its typical
usage is to apply it to each row of the output of
make_inventory_list and to obtain a list of
fe_ccircle_spatial objects this way. Data standard
is Bavarian State Forest (BaySF) so far.
Usage
fe_ccircle_fromlist(
x,
trees_column_name,
circles_column_name,
center_coord_name,
small_trees_name,
height_method = c("NFI", "Bavaria")
)
Arguments
x |
a data frame or a list with unequivocal key, and two columns with
data frames for trees and circle definition, typically the output of
|
trees_column_name |
name of the column where the tree lists are stored |
circles_column_name |
name of the column where the circle definitions are stored |
center_coord_name |
name of the column containing the center coordinates in Gauss-Krueger |
small_trees_name |
name of the column containing the small trees, i.e. trees with no dbh because their height is < 1.3 m |
height_method |
height estimation method for trees with missing heights, "NFI" height curves are defined as default, alternatively "Bavaria" can be selected, but in this case tree ages must be provided |
Value
an object of fe_ccircle_spatial
Internal CRS registry
Description
A named vector mapping short CRS keys used internally in FeNEU to EPSG codes. The registry defines the coordinate reference systems supported by inventory import and conversion functions.
Usage
fe_crs_registry
Details
Supported CRS keys:
- lonlat
WGS84 geographic coordinates (EPSG:4326)
- etrs89
ETRS89 geographic coordinates (EPSG:4258)
- utm32
ETRS89 / UTM zone 32N (EPSG:25832)
- utm33
ETRS89 / UTM zone 33N (EPSG:25833)
- gk2
DHDN / Gauss-Krueger zone 2 (EPSG:31466)
- gk3
DHDN / Gauss-Krueger zone 3 (EPSG:31467)
- gk4
DHDN / Gauss-Krueger zone 4 (EPSG:31468)
- gk5
DHDN / Gauss-Krueger zone 5 (EPSG:31469)
Standard Construction of an fe_inventory Object
Description
Standard Construction of an fe_inventory Object
Usage
fe_inventory(
inventory_list,
object_type = c("fe_stand", "fe_stand_spatial", "fe_ccircle_spatial")
)
Arguments
inventory_list |
A tibble with the inventory data containing the necessary three columns with plot_id, the plot objects, and the inv_rep_area |
object_type |
Character to define what type of objects will be save
as inventory points: |
Value
If the information provided allows to construct a valid
fe_inventory object, this object will be returned. The function will
terminate with an error otherwise
Examples
# fe_inventory() is the constructor at the end of the import pipeline. It
# is normally reached through the public entry point read_and_convert_data(),
# which builds the intermediate inventory list and calls fe_inventory()
# internally.
in_path <- system.file("extdata", "data_ex3_sample_pre", package = "FeNEU")
read_and_convert_data(in_path, inventory_type = "sample_concentric",
coord_sys = "gk4")
Normalise plot center coordinates and attach CRS metadata
Description
Internal helper to standardise plot center coordinates and associate them with a coordinate reference system (CRS). The function resolves the CRS from a short key, applies Gauss-Krueger zone-prefix correction if required, and stores CRS information as attributes.
Usage
fe_normalise_coordinates(
coordinate,
coord_sys = coord_sys,
epsg = NULL,
x_col = "gauss_rw",
y_col = "gauss_hw",
coord_sys_declared = TRUE,
check_envelope = TRUE
)
Arguments
coordinate |
A data frame containing plot center coordinates. |
coord_sys |
Character CRS key (see Details). Default is "gk4". |
epsg |
Optional integer EPSG code, used only if coord_sys = "epsg". |
x_col |
Name of the x coordinate column. Default "gauss_rw". |
y_col |
Name of the y coordinate column. Default "gauss_hw". |
Details
Supported CRS keys (Germany-focused):
- lonlat
WGS84 geographic coordinates (EPSG:4326)
- utm32
ETRS89 / UTM zone 32N (EPSG:25832)
- utm33
ETRS89 / UTM zone 33N (EPSG:25833)
- gk2
DHDN / Gauss-Krueger zone 2 (EPSG:31466)
- gk3
DHDN / Gauss-Krueger zone 3 (EPSG:31467)
- gk4
DHDN / Gauss-Krueger zone 4 (EPSG:31468)
- gk5
DHDN / Gauss-Krueger zone 5 (EPSG:31469)
- epsg
User-supplied EPSG code
For Gauss-Krueger systems, the function automatically checks whether the Rechtswert appears to be missing the zone prefix and adds it if necessary.
Value
The input data frame with unchanged structure, but with CRS metadata attached as attributes:
- fe_crs
An
sf::crsobject- fe_coord_sys
Resolved CRS key
- fe_coord_cols
Coordinate column names
Generate a fe_ccircle_spatial Object From an Output
Row of make_inventory_list
Description
Standard users do not need to call this function directly. Its typical
usage is to apply it to each row of the output of
make_inventory_list and to obtain a list of
fe_ccircle_spatial objects this way. Data standard
is Bavarian State Forest (BaySF) so far.
Usage
fe_stand_fromlist(x, trees_column_name, height_method = c("NFI", "Bavaria"))
Arguments
x |
a data frame or a list with unequivocal key, and two columns with
data frames for trees and circle definition, typically the output of
|
trees_column_name |
name of the column where the tree lists are stored |
height_method |
height estimation method for trees with missing heights, "NFI" height curves are defined as default, alternatively "Bavaria" can be selected, but in this case tree ages must be provided |
Value
an object of fe_stand
Write Estimated Heights at Inventory Level Back Into the Original fe_inventory Object
Description
This procedure can be time consuming with large inventories, therefore
parallel processing is used (see parameter free_cores).
Usage
fill_heights_back(
inv_dat,
pulled_est_height,
small_trees = FALSE,
.progress = TRUE,
free_cores = 4
)
Arguments
inv_dat |
Object of class |
pulled_est_height |
tibble which was pulled from an |
small_trees |
|
.progress |
Logical, if |
free_cores |
Integer, indicating the number of processor cores which
will not be assigned to parallel processing tasks. If |
Value
The input fe_inventory object with updated heights
Examples
# Estimate heights - only the pulled tree tibble is affected so far
suppressWarnings(
# Warnings come from an intentional species code casts - no problem here
inventory_est_heights <- data_ex3_sample_fe_inventory |>
pull_trees() |>
height_complete_inventory(method = "NFI")
)
# Now write the heights back into the original object or, as in this case,
# an otherwise identical copy of it
peg_fe_inventory_updated <- fill_heights_back(
data_ex3_sample_fe_inventory, inventory_est_heights
)
Generate a Circle-Definition File for a Concentric Sample Inventory
Description
Writes an fe_ikl-keyed circle-definition file (default
Probekreisdefinition.txt) for the concentric sample import chain
(import_sample_concentric_format1_raw_to_pre,
import_sample_concentric_format2_raw_to_pre). The concentric
importers require a circle definition; when a ready-made one is not at hand,
this helper produces a uniform definition – the same set of
concentric circles for every plot – written as a single
fe_ikl = "ALL" group. (For multiple circle classes, write the file
yourself with one integer fe_ikl per class and link each inventory
point to its class via its own fe_ikl column.)
Usage
generate_circle_definition(
output_dir,
dbh_cm_from,
radiuses_m,
filename = "Probekreisdefinition"
)
Arguments
output_dir |
Folder the file is written to (character). Created if it does not exist. |
dbh_cm_from |
Numeric vector of lower DBH limits in cm, one per
concentric circle (e.g. |
radiuses_m |
Numeric vector of circle radii in m, the same
length as |
filename |
Base file name with or without the |
Details
There is deliberately no default geometry: the caller must supply
dbh_cm_from and radiuses_m, because the evaluation results
depend directly on the circle sizes. These parameter names match those of the
concentric raw importers.
Value
The path of the written file (invisibly).
See Also
import_sample_concentric_format1_raw_to_pre,
import_sample_concentric_format2_raw_to_pre
Examples
dir <- tempdir()
generate_circle_definition(
dir,
dbh_cm_from = c(0, 12, 30),
radiuses_m = c(2.82, 5.64, 12.62)
)
Survey Year of an Inventory Object
Description
Returns the unique survey year (time_yr) of an inventory object.
At present a method is provided for fe_inventory, where
uniformity of time_yr across all plots is guaranteed by the
fe_inventory constructor; the method does a defensive check
regardless.
Usage
get_inv_year(x, ...)
## S3 method for class 'fe_inventory'
get_inv_year(x, ...)
Arguments
x |
An inventory object. |
... |
Currently unused, reserved for method-specific extensions. |
Value
A single numeric value: the survey year.
Examples
get_inv_year(data_ex3_sample_fe_inventory)
Calculate ha-wise Increments per Plot, Species Group, and Age Class
Description
The increments added to the output of plot_inc_gnfi_2012 here
relate to virtual species (group) area shares. The calculation is only done
for the main stand, because otherwise the species area shares will not make
too much sense.
Usage
ha_inc_main_stand_age_class(x, data_filter = !.data$removal)
Arguments
x |
A data frame generated with |
data_filter |
Logical expression relating to the columns of x. Default is !.data$removal, i.e. the removal stand is not included in the increment calculation. Independently, there is always an internal filter on layer_key == 1, which does only take into account main stand trees |
Value
A data frame that is the input x with additional columns
representing the species groups' area shares, absolute areas and the
related increments per ha
Harmonize First Inventory for Repeated Survey Increment Calculation
Description
For matched plot pairs from two subsequent inventories, this function ensures
that the slope values in the first inventory's circle definitions match
those of the second inventory. This is important because differing slope
assessments lead to different n_rep_ha values for the same tree in
the same concentric circle, which can distort increment calculations and
cause false circle-transition detections.
Usage
harmonize_inv_for_repsurv(inv_1st, inv_2nd, plot_matches)
Arguments
inv_1st |
An object of class |
inv_2nd |
An object of class |
plot_matches |
Output of |
Details
The function modifies the circle_definition$slope of matched plots in
inv_1st to the value found in the corresponding plot of
inv_2nd. Missing (NA) slopes are treated as 0 (flat terrain).
Plots where neither circle definition contains a slope column are
skipped, as are plots with empty circle definitions (notrees plots).
After the slope correction, n_rep_ha is recalculated for affected
trees using n_rep_ha, and the modified plot
objects are revalidated with
validate_fe_ccircle_spatial.
After harmonization, the user should re-derive the tree data from the
returned inventory object (e.g. via pull_trees |>
height_complete_inventory |> trees_add_essentials).
Value
A modified copy of inv_1st where the slope values in
matched plots have been set to the corresponding values from
inv_2nd and n_rep_ha has been recalculated accordingly.
Unmatched plots are returned unchanged.
See Also
Other increment:
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other repeated inventory:
inv_increment_repsurv_ccirc(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
reclassify_pseudo_ingrowth_ccirc()
Other inventory matches:
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc()
Examples
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
plot_matches <- match_2_inventories(
inv_a, inv_b, match_type = "plot_id", "baysf"
)
inv_a_harmonized <- harmonize_inv_for_repsurv(inv_a, inv_b, plot_matches)
Complete Heights for Non-Measured Trees in an Inventory
Description
Typically in an inventory, height measurements are done only for a part of the sampled trees. This function provides reasonable estimates for the missing heights.
Usage
height_complete_inventory(
pulled_inventory,
d_q_interval = 5,
method = c("NFI", "Bavaria"),
diagnostic = FALSE
)
Arguments
pulled_inventory |
Tibble with tree list for the whole inventory,
typically the output of |
d_q_interval |
Integer indicating the interval breaks for the dq (quadratic mean diameter) classes to be formed. Default is 5-cm-classes, where all dq values over 60 cm are all put into the same class. |
method |
Height estimation method for trees with missing heights, "NFI" height curves are defined as default, alternatively "Bavaria" can be selected, but in this case an age must be provided for every tree (see Details) |
diagnostic |
Logical, if TRUE, the function provides diagnostic output, which is NOT compatible with the standard output and its usage. Default is FALSE. Use TRUE only, if you know exactly what you are doing. |
Details
The function first identifies quadratic mean diameter (dq) classes grouped by
species group (i.e. fe_species_tum_wwk_short),
and stand layer level for each plot. These classes are then applied to the
whole inventory (i.e. omitting the grouping by plot), to calculate a dq
value for each dq class, species group, and stand layer. From the
height-measured trees a corresponding hq (quadratic mean height) is
calculated. In case there are no height measured trees in a group, so that
there is no data-based estimate of hq possible the function
h_q_from_d_q is used as a fallback. In this
case a warning is issued.
Both, hq and dq are the entry points for the subsequent individual tree
height estimates which are based on the individual trees' dbh. Note that for
the height estimation method "Bavaria" also an age must be given for each
tree (usually the stand or stand layer age).
The estimation methods "NFI", and "Bavaria" use the standard height curve
systems h_standard_gnfi3, and
h_standard_bv, respectively.
Value
A tibble in the same format as the input pulled_inventory,
but with the additional columns h_est_m, i.e. height estimates for
every tree, species_group, d_q_cm, and h_q_m.
Examples
# Pull tree data from an fe_inventory object
pulled_inventory <- data_ex3_sample_fe_inventory |>
pull_trees()
# Use the NFI method. The h_q fallback warning is expected here where a
# species x layer group has no measured height.
suppressWarnings(
height_complete_inventory(pulled_inventory, method = "NFI")
)
# ... and the Bavaria method on the same data
suppressWarnings(
height_complete_inventory(pulled_inventory, method = "Bavaria")
)
Import BaySF-style named flat files (experimental preview of Format 3)
Description
Reads a folder that already contains BaySF-style named flat files
(BHD.txt, Inventurpunkte.txt, SCH.txt) and re-shapes
them into the standard BaySF intermediate output files
(fdinvbhd.txt, fdinvba.txt, fdinvkrs.txt,
fcbestku.txt, fdvikrs.txt). Unlike
import_sample_concentric_format1_raw_to_pre() /
import_sample_concentric_format2_raw_to_pre(), which convert
field-collected raw data, this reader expects files that are already close
to the BaySF target format.
Usage
import_data_BaySF_inraw(
input_path,
bhds_from = bhds_from,
radiuses = radiuses,
year = year
)
Arguments
input_path |
Path of the input data folder (character) |
bhds_from |
A vector of the lower diameter limits of the concentric circles (numeric) |
radiuses |
A vector of the radiuses of the concentric circles (numeric) |
year |
The year of the inventory (numeric) |
Details
This is an early, experimental reader for a third, “BaySF-named” raw
input format. It is not part of the public import API, carries no correctness
or stability guarantee, and its interface may change. It will probably
converge into the future import_sample_concentric_format_3_raw_to_pre.
Import BaySF-style deadwood inventory data
Description
Usage
import_deadwood_data_baysf(input_path)
Arguments
input_path |
Path to the input data folder (character). The folder
must contain the file |
Details
Wrapper that reads BaySF-style deadwood inventory data from the text file
fdinvtot.txt and converts the raw column names to the internal
FeNEU / ForestElementsR naming convention used for deadwood processing.
Deadwood import is not part of the first release and may change.
Value
A tibble with standardized deadwood variables (one row per deadwood object).
Convert raw sample inventory data (format 1) to preprocessed BaySF style data
Description
Reads format 1 raw sample inventory data collected with the concentric-circle
method and writes the five standard BaySF-style intermediate files
(fdinvbhd.txt, fdinvba.txt, fdinvkrs.txt,
fcbestku.txt, fdvikrs.txt) into output_dir.
Usage
import_sample_concentric_format1_raw_to_pre(
input_path,
output_dir,
treelist_filename = "Baumschicht.txt",
inv_punkt_filename = "Inv_punkt.txt",
small_trees_filename = NULL,
circle_def_filename = NULL,
species_guess = FALSE,
dbh_cm_from = NULL,
radiuses_m = NULL,
coord_sys = NULL,
inventory_year = NULL,
encoding = "auto"
)
Arguments
input_path |
Path to the folder holding the source files (character). |
output_dir |
Folder the preprocessed BaySF-style files are written to (character, required). There is deliberately no default: the function writes files, and a default would write into the folder the raw data came from, i.e. into the user's own filespace. Created if it does not exist. Untouched if validation fails. Should the plot ids of the tree list and the inventory-point file not match,
two diagnostic files listing the offending plots are written here as well:
|
treelist_filename |
Name of the tree-list file (with or without the
Required columns (German alias in parentheses):
Optional columns:
Any further columns are ignored – extra columns do not disturb the import, they are simply not used. As FeNEU develops, more columns may become supported (this applies to all raw import formats). |
inv_punkt_filename |
Name of the inventory-point file (with or without the
Required columns (German alias in parentheses):
Optional columns:
Further columns are ignored (they do not disturb the import). |
small_trees_filename |
Name of the small-tree file (with or without the
Optional columns:
Any further columns are ignored (they do not disturb the import). |
circle_def_filename |
Name of the circle-definition file (with or
without the |
species_guess |
Logical. If This is a stopgap for real-world data whose species column holds
text abbreviations instead of codes. We strongly recommend
supplying the proper numeric BaySF species codes ( |
dbh_cm_from |
Numeric vector of lower DBH limits in cm for each
concentric circle, or |
radiuses_m |
Numeric vector of circle radii in m, or |
coord_sys |
Coordinate reference system of The system is never guessed: if neither the column nor this argument states it, the import fails and says so; if both do and they disagree, it fails and names both; and if the declaration contradicts the magnitude of the coordinates (geographic values declared as projected or vice versa), it fails with a concrete suggestion. The preprocessed |
inventory_year |
Optional single survey year (e.g. Downstream only the year is kept (each plot object carries a single
|
encoding |
Character encoding of the source |
Details
Column names in the source files are case-insensitive (converted to lower case internally). Both English canonical names and their German equivalents are accepted; the German alias is silently renamed to the English canonical before validation.
In its raw encoding, Format 1 records measurements in familiar units (DBH in
cm, height in m), the tree position as a single azimuth angle (degrees)
plus a distance (m), the stand layer directly as BaySF layer codes, and
both living and dead trees. Format 2 encodes the same information differently
(DBH in mm, a gon-or-degree back azimuth with a unit flag, its own layer code,
living trees only); see
import_sample_concentric_format2_raw_to_pre.
Stand age. Age in forest inventories always refers to the stand or stand layer, never to the individual tree, even though it is recorded redundantly in every tree row. It is optional: in structure-rich, uneven-aged stands – increasingly important in practice – a meaningful stand age often cannot be given. When the age is missing or incomplete, the analyses that group by age class are unavailable: base tables and structure tables by age class, and the age-class breakdown of increment from a repeated inventory – all of these can be run by mean-diameter (dq) class instead. Increment from yield tables and from the BWI3 (gnfi3) functions requires the age and is not possible without it. A warning is issued on import whenever the age is absent or has gaps, so an accidental omission can be noticed and corrected; users whose forest structure genuinely precludes a stand age can ignore it.
No height completion is performed here. Measured tree heights are carried
through as given (missing heights stay NA); the converter only records
which heights were measured (internal hmb flag) and normalises their
unit where the raw format requires it. Estimating the missing heights is a
deliberate, separate downstream step –
pull_trees() |> height_complete_inventory() |> fill_heights_back() –
so that measured and estimated heights are never silently mixed.
Value
A named list (the common raw-to-pre report): ok (logical),
errors (character), warnings (character), paths
(the written files, or NULL if !ok), species_mapping
and needs_review. On success it writes fdinvbhd.txt,
fdinvba.txt, fdinvkrs.txt, fcbestku.txt, and
fdvikrs.txt into output_dir.
When species_guess = TRUE, species_mapping is a tibble with
one row per raw species abbreviation (raw, n_trees,
canonical, species_id, name_ger, tier). A
tier of "confirmed" means an exact or case-insensitive match;
"review" means the code was resolved only by substring / fuzzy /
mojibake matching and is worth a manual check. needs_review is
TRUE whenever any row is "review" (with a matching warning);
both are NULL/FALSE when species_guess = FALSE.
Format 1 and Format 2
FeNEU currently supports two raw data formats for sample inventories with
concentric circles. The two grew up in parallel with FeNEU itself and have no
fundamental differences in content – they simply reflect different user
preferences for how the data are exported. We call them “Format 1” and
“Format 2”. This function reads Format 1; Format 2 is read by
import_sample_concentric_format2_raw_to_pre. Both produce the
same BaySF-style preprocessed files, so everything downstream is identical.
Examples
# Use example raw input data shipped with the package
# and write them to a temporary folder.
td <- tempdir()
# Write example tables under the recommended Format-1 file names
readr::write_delim(
data_ex1_sample_raw_trees,
file = file.path(td, "Baumschicht.txt"),
delim = "\t"
)
readr::write_delim(
data_ex1_sample_raw_points,
file = file.path(td, "Inv_punkt.txt"),
delim = "\t"
)
readr::write_delim(
data_ex1_sample_raw_smalltrees,
file = file.path(td, "Verjuengung.txt"),
delim = "\t"
)
# Definition of concentric sample circles
dbh_cm_from <- c(0, 12, 30, 48)
radiuses_m <- c(2.82, 5.64, 11.28, 17.84)
# Create BaySF-style intermediate files in a separate temporary folder
# (function is called for its side effects). output_dir is mandatory --
# the converter never picks a target folder itself.
out_dir <- file.path(tempdir(), "pre_ex1")
import_sample_concentric_format1_raw_to_pre(
input_path = td,
output_dir = out_dir,
treelist_filename = "Baumschicht",
inv_punkt_filename = "Inv_punkt",
small_trees_filename = "Verjuengung",
species_guess = TRUE,
dbh_cm_from = dbh_cm_from,
radiuses_m = radiuses_m,
coord_sys = "gk4"
)
# Check that one of the output files was created
file.exists(file.path(out_dir, "fdinvbhd.txt"))
Convert raw sample inventory data (format 2) to preprocessed BaySF style data
Description
Reads format 2 raw sample inventory data collected with the concentric circle
method and writes the standard preprocessed BaySF-style intermediate files
(fdinvbhd.txt, fdinvba.txt, fdinvkrs.txt,
fcbestku.txt, fdvikrs.txt) into output_dir.
Usage
import_sample_concentric_format2_raw_to_pre(
input_path,
output_dir,
treelist_filename = "02_probekreis.txt",
inv_punkt_filename = "01_root_entity.txt",
circle_def_filename = NULL,
species_guess = FALSE,
dbh_cm_from = NULL,
radiuses_m = NULL,
coord_sys = NULL,
inventory_year = NULL,
encoding = "auto"
)
Arguments
input_path |
Path to the folder holding the source files (character). |
output_dir |
Folder the preprocessed BaySF-style files are written to (character, required). There is deliberately no default: the function writes files, and a default would write into the folder the raw data came from, i.e. into the user's own filespace. Created if it does not exist. Untouched if validation fails. |
treelist_filename |
Name of the tree-list file (Format 2 source table 02,
with or without the Required columns:
Optional columns:
Any further columns are ignored – extra columns do not disturb the import. Format 2 records only living trees (no mortality column); mortality is set to 0 for every record. |
inv_punkt_filename |
Name of the inventory-point file (Format 2 source
table 01, with or without the Required columns:
Optional columns:
Any further columns are ignored – extra columns do not disturb the import. |
circle_def_filename |
Name of the circle-definition file (with or
without the In practice Format 2 runs uniform: its source tables carry no
circle-class key (the inventory-point table has no |
species_guess |
Logical. Currently unused; reserved for future
species-guessing support. Default is |
dbh_cm_from |
Numeric vector of lower DBH limits (cm) for each concentric
circle, or |
radiuses_m |
Numeric vector of circle radii (m), or |
coord_sys |
Coordinate reference system of the plot-centre coordinates,
or The native Format-2 export stores geographic coordinates and
declares them ( The preprocessed |
inventory_year |
Optional single survey year (e.g. Downstream only the year is kept (each plot object carries a single
|
encoding |
Character encoding of the source |
Details
Format 2 defines nine source tables in total. This converter
currently supports only the narrow core – two tables: the main tree list
(02) and the inventory-point / coordinate table (01). Importers for the
remaining tables are under construction: the tree-property data
(03), regeneration incl. height classes (04-06, 08), and dead wood (07, 09)
are not read yet. In particular, Format 2 has its own dedicated
small-tree / regeneration format, for which a reader will be added in the
future; until then no regeneration / small-tree records are produced, so this
converter never yields the bhd == 0 tally rows that the BaySF-style
pre-reader would otherwise split off into small trees.
In its raw encoding, Format 2 records DBH in mm and heights in dm, the tree
position as a back azimuth given in gon or degrees (disambiguated by a unit
flag) plus a distance in cm, its own stand-layer code (remapped to BaySF
codes, see above), and living trees only. Format 1 encodes the same
information differently (cm and m, a single degree azimuth, BaySF layer codes
directly, living and dead trees); see
import_sample_concentric_format1_raw_to_pre.
Stand age. Age in forest inventories always refers to the stand or stand layer, never to the individual tree, even though it is recorded redundantly in every tree row. It is optional: in structure-rich, uneven-aged stands – increasingly important in practice – a meaningful stand age often cannot be given. When the age is missing or incomplete, the analyses that group by age class are unavailable: base tables and structure tables by age class, and the age-class breakdown of increment from a repeated inventory – all of these can be run by mean-diameter (dq) class instead. Increment from yield tables and from the BWI3 (gnfi3) functions requires the age and is not possible without it. A warning is issued on import whenever the age is absent or has gaps, so an accidental omission can be noticed and corrected; users whose forest structure genuinely precludes a stand age can ignore it.
No height completion is performed here. Measured tree heights are carried
through as given (missing heights stay NA); the converter only records
which heights were measured (internal hmb flag) and normalises their
unit where the raw format requires it (Format 2 stores heights in dm).
Estimating the missing heights is a deliberate, separate downstream step –
pull_trees() |> height_complete_inventory() |> fill_heights_back() –
so that measured and estimated heights are never silently mixed.
Value
A named list (the common raw-to-pre report): ok (logical),
errors (character), warnings (character), and paths
(the written files, or NULL if !ok). On success it writes
fdinvbhd.txt, fdinvba.txt, fdinvkrs.txt,
fcbestku.txt, and fdvikrs.txt into output_dir.
Format 1 and Format 2
FeNEU currently supports two raw data formats for sample inventories with
concentric circles. The two grew up in parallel with FeNEU itself and have no
fundamental differences in content – they simply reflect different user
preferences for how the data are exported. We call them “Format 1” and
“Format 2”. This function reads Format 2; Format 1 is read by
import_sample_concentric_format1_raw_to_pre. Both produce the
same BaySF-style preprocessed files, so everything downstream is identical.
Stand-layer coding (bestku)
Format 2 codes the stand layer in the tree-list column bestku
differently from the BaySF-style pre format and from Format 1. The
converter therefore remaps the Format-2 codes
onto the BaySF layer codes that the rest of the pipeline (the fcbestku
table and the internal layer_key) expects:
Format 2 (bestku) | -> | BaySF code |
| 1 Hauptschicht | -> | 1 Oberschicht (main stand) |
| 2 Zwischenschicht | -> | 2 Unterstand |
| 3 Unterschicht | -> | 2 Unterstand |
| 4 Vorausverjuengung | -> | 3 Vorausverjuengung |
| 5 Ueberhaelter/Nachhiebsrest | -> | 5 Ueberhaelter |
Note in particular that the same number means different things in the two
codings (e.g. Format-2 bestku = 4 is advance regeneration, whereas
BaySF/Format-1 code 4 is residual stand). The main stand (code 1) is
identical in both. Format 2's two sub-canopy layers (Zwischenschicht,
Unterschicht) are both mapped to the single BaySF Unterstand, and Format 2's
combined Ueberhaelter/Nachhiebsrest maps to Ueberhaelter.
Examples
# Use example raw input data shipped with the package
# and write them to a temporary folder under the default
# file names, so the converter can be called with its defaults.
td <- tempdir()
readr::write_delim(
data_ex2_sample_raw_trees,
file = file.path(td, "02_probekreis.txt"),
delim = "\t"
)
readr::write_delim(
data_ex2_sample_raw_points,
file = file.path(td, "01_root_entity.txt"),
delim = "\t"
)
# Definition of concentric sample circles
dbh_cm_from <- c(0, 12, 30)
radiuses_m <- c(2., 6.31, 12.62)
# Create BaySF-style intermediate files in a separate temporary folder
# (function is called for its side effects; the file names default to the
# format's standard names "02_probekreis.txt" / "01_root_entity.txt").
# output_dir is mandatory -- the converter never picks a target itself.
# The example points carry their own srs (EPSG:4326), so no coord_sys is
# needed; inventory_year is passed because the native date_created is the
# ambiguous DD-MM-YY.
out_dir <- file.path(tempdir(), "pre_ex2")
import_sample_concentric_format2_raw_to_pre(
input_path = td,
output_dir = out_dir,
dbh_cm_from = dbh_cm_from,
radiuses_m = radiuses_m,
inventory_year = 2025
)
# Check that one of the output files was created
file.exists(file.path(out_dir, "fdinvbhd.txt"))
Concentric Sample Inventory: Preprocessed Files to fe_inventory
Description
The pre-to-fe_inventory step of the concentric sample import chain. Reads a
folder of preprocessed BaySF-style files (fdinvbhd.txt,
fdinvba.txt, fdinvkrs.txt, fcbestku.txt,
fdvikrs.txt) – produced by
import_sample_concentric_format1_raw_to_pre /
import_sample_concentric_format2_raw_to_pre, or supplied
directly in that shape – and builds an fe_inventory of
fe_ccircle_spatial plots.
Usage
import_sample_concentric_pre_to_fe_inventory(
input_path,
style = "baysf",
coord_sys = NULL,
check_envelope = TRUE,
encoding = "auto"
)
Arguments
input_path |
Folder holding the preprocessed BaySF-style files (character). |
style |
Format family of the preprocessed data. Currently only
|
coord_sys |
Coordinate reference system of the plot coordinates; see
Geographic coordinates ( State |
check_envelope |
Logical, default |
encoding |
Character encoding of the preprocessed |
Details
Counterpart to import_standwise_relascope_pre_to_fe_inventory.
Building the inventory objects can take a while for large forest units
(thousands of plots). Progress is reported through the progressr
framework, one step per plot. By default nothing is shown; wrap the call to
see a progress bar, and the same code drives a native Shiny progress bar
inside shiny::withProgress() / progressr::withProgressShiny():
progressr::handlers("cli")
progressr::with_progress(
inv <- import_sample_concentric_pre_to_fe_inventory(input_path)
)
No height completion is performed here either: the returned inventory carries
the measured heights as they are (missing ones stay NA). Estimating
them is a deliberate, separate downstream step –
pull_trees() |> height_complete_inventory() |> fill_heights_back().
Value
An fe_inventory of fe_ccircle_spatial plots.
A note on the BaySF-style column names
The plot-centre coordinate columns are named gauss_rw/gauss_hw
(Gauss-Krueger Rechtswert / Hochwert) for historical reasons, but
modern BaySF exports store UTM32 (ETRS89 / UTM zone 32N) values in
them – the “gauss” name is a legacy label, not a statement about the
CRS (native files even carry a GAUSS_KZ zone field that no longer
reflects the actual system). FeNEU therefore never infers the CRS from the
column name: pre files it writes itself record the real CRS in a
coord_sys column (self-describing, so no argument is needed here),
while a genuine BaySF export has no such column and you must pass
coord_sys explicitly – for current data that is almost always
"utm32".
See Also
import_sample_concentric_format1_raw_to_pre,
read_and_convert_data
Examples
# The bundled example pre carries a coord_sys column (utm32), so it is
# self-describing and needs no coord_sys argument.
inv_path <- system.file("extdata", "data_ex3_sample_pre",
package = "FeNEU")
inv <- import_sample_concentric_pre_to_fe_inventory(inv_path)
inv
Import Per-Stand Metadata Companion to Format 1 Standwise Inventory Data
Description
Reads a per-stand metadata file (default name Inventuraufnahmen.txt)
coming with Format 1 standwise inventory data (Silvarith-style) and returns
one tibble row per stand with canonical lower-case ASCII column names. This
is the metadata companion used by
import_standwise_relascope_format1_stand_register_bundle and
produces a tibble suitable as the stand_data argument of
stand_register_pdf.
Usage
import_standwise_relascope_format1_metadata(
input_path,
filename = "Inventuraufnahmen",
encoding = "auto"
)
Arguments
input_path |
Path of the folder containing the source file (character). |
filename |
File name (without |
encoding |
Character encoding. Default |
Details
The source file's headers are very long and can contain special characters
(Ø, slashes, parentheses, German umlauts), so columns are matched
by position rather than by name — the file must have exactly 13
columns in the order shown below.
Canonical columns (in order):
- bestand
Stand identifier (character, matches the WZP
bestandcolumn).- bestandesform
Stand-form classification (e.g.
"Kie-Lä-Bu").- alter_mittel
Mean stand age in years.
- nutzungsart
Management type code (e.g.
"VJT","LB").- bemerkung
Free-text remark (may be empty).
- bestflaeche
Stand area in ha.
- bestockungsgrad
Stocking degree (BG, dimensionless).
- vorrat_efm_ha
Standing volume in efm D.o.R. per ha.
- aufnahmeart
Survey type: 1 = VK, 2 = WZP, 4 = fest. PK, 5 = konz. PK.
- zaehlbreite
Angle-count factor or max. circle area, as a string (e.g.
"ZB 4,0").- n_stichproben
Number of sample plots in the stand.
- stp_pro_ha
Plot density (STP / ha).
- stdfehler_pct
Sampling error of standing volume in percent (numeric, parsed from strings like
"24,4%").
Value
A tibble with one row per stand and the 13 canonical columns described above.
See Also
import_standwise_relascope_format1_stand_register_bundle,
stand_register_pdf
Import a Stand-Wise Angle-Count Inventory: Silvarith-style Raw to Preprocessed
Description
The raw-to-pre step of the stand-wise relascope
(“Winkelzählprobe” / angle-count) import chain. Reads a
Silvarith-style raw tree file (EingabedatenGesamt.txt: German locale
– decimal comma, umlaut headers, DD.MM.YYYY dates), validates it
(collecting every problem rather than stopping at the first), and –
if valid – writes the preprocessed WZP_Daten.txt (the canonical
ASCII / decimal-point form) that
import_standwise_relascope_pre_to_fe_inventory reads.
Usage
import_standwise_relascope_format1_raw_to_pre(
input_path,
output_dir,
treelist_filename = "EingabedatenGesamt.txt",
encoding = "auto"
)
Arguments
input_path |
Folder holding the raw file (character). |
output_dir |
Folder the preprocessed |
treelist_filename |
Raw file name, with or without the |
encoding |
Character encoding of the source file. Default |
Details
This is the direct counterpart to
import_sample_concentric_format1_raw_to_pre for concentric
sample inventories: a single top-level converter that performs its own
validation (“plausi”) internally and returns a collected report. There
is no separately exported plausi function.
“Silvarith-style” describes the shape of the data. Silvarith is
a stand-wise angle-count software; this importer targets its export layout
without claiming exact or official compatibility. A user who already holds a
WZP_Daten.txt – Silvarith also produces one directly, or it was made
earlier by this function – skips this step and goes straight to
import_standwise_relascope_pre_to_fe_inventory.
Required columns (after tolower() of the header):
- stpnr
Plot number within the stand (integer).
- lfdnrstp
Sequential record number within the plot; renamed to
lfd_nr.- bestand
Stand identifier (character).
- best.-fläche
Stand area in ha (decimal comma); renamed to
bestflaeche.- zf
Angle-count factor; renamed to
zaehlfaktor.- ba
Species code in BaySF coding; renamed to
baumart.- alter
Age in years (integer).
- schicht
Silvarith layer code in {0, 1, 2, 3}: 0 = main stand (Hauptschicht), 1 = harvest remnants (Nachhiebsreste), 2 = veterans (Ueberhaelter) – 1 and 2 both fall into the remnant/veteran layer – 3 = understorey (Unter-/Zwischenschicht). Mapped to
fe_standlayer_keyinimport_standwise_relascope_pre_to_fe_inventory; Silvarith has no code for advance regeneration.- anz.
Tree count for this record; renamed to
anzahl.- bhd
DBH in cm (decimal comma).
- höhe
Height in m (decimal comma); renamed to
hoehe.- stichtag
Survey date in
DD.MM.YYYYformat.
Collected checks: bhd non-negative; schicht in
{0, 1, 2, 3}; stichtag parseable as %d.%m.%Y;
hoehe > 50 m raises a (non-blocking) warning.
No height completion is performed here, and missing heights are not rejected:
measured tree heights are carried through as given (missing ones stay
NA). Estimating the missing heights is a deliberate, separate
downstream step –
pull_trees() |> height_complete_inventory() |> fill_heights_back() –
so that measured and estimated heights are never silently mixed. (Angle-count
surveys usually measure a height for every tallied tree, so missing heights
are uncommon here, but they are tolerated.)
Value
A named list (the common raw-to-pre report):
- ok
Logical.
TRUEif the file passed validation and was written.- errors
Character vector of validation problems; empty if
ok.- warnings
Character vector of non-blocking notices; may be non-empty even when
ok.- paths
Character vector of written files, or
NULLif!ok.
See Also
import_standwise_relascope_pre_to_fe_inventory,
import_sample_concentric_format1_raw_to_pre
Examples
# The bundled example uses the canonical Silvarith export name
# "EingabedatenGesamt.txt" (the default of `treelist_filename`).
sil_dir <- system.file("extdata", "data_ex6_standwise_raw", package = "FeNEU")
out_dir <- tempdir()
result <- import_standwise_relascope_format1_raw_to_pre(
sil_dir, output_dir = out_dir
)
result$ok
result$paths
Import a Standwise Format 1 Data Bundle (Trees + Stand Metadata) Required For a Stand Register (Revierbuch)
Description
Convenience orchestrator that reads both, a raw standwise Format 1 input file,
and its metadata companion (both Silvarith-style) for one forest management
unit from a single folder and returns the two artefacts needed for a
stand_register_pdf call:
-
fe_inv— anfe_inventoryoffe_standobjects, built from the Silvarith-style trees export via the two-stage relascope import chain (import_standwise_relascope_format1_raw_to_pre+import_standwise_relascope_pre_to_fe_inventory). -
stand_data— per-stand metadata read fromInventuraufnahmen.txtviaimport_standwise_relascope_format1_metadata.
Usage
import_standwise_relascope_format1_stand_register_bundle(
input_path,
treelist_filename = "EingabedatenGesamt",
inventuraufnahmen_filename = "Inventuraufnahmen",
encoding = "auto"
)
Arguments
input_path |
Path of the folder containing both source files (character). |
treelist_filename |
File name of the trees export (without
|
inventuraufnahmen_filename |
File name of the metadata export
(without |
encoding |
Character encoding for both files. Default |
Details
Cross-checks that every stand referenced in the inventory has a
corresponding row in stand_data and emits a warning if any are
missing (the inventory data is still returned in that case).
Value
A named list with elements fe_inv (an
fe_inventory) and stand_data (a tibble).
See Also
import_standwise_relascope_format1_metadata,
import_standwise_relascope_format1_raw_to_pre,
stand_register_pdf
Stand-Wise Relascope Inventory: Preprocessed WZP_Daten.txt to fe_inventory
Description
The pre-to-fe_inventory step of the stand-wise relascope
(“Winkelzählprobe” / angle-count) import chain. Reads the preprocessed
WZP_Daten.txt – produced by
import_standwise_relascope_format1_raw_to_pre, or a
Silvarith-style WZP_Daten.txt supplied directly – and builds an
fe_inventory of fe_stand plots.
Usage
import_standwise_relascope_pre_to_fe_inventory(
input_path,
style = "silvarith",
encoding = "auto"
)
Arguments
input_path |
Folder holding the preprocessed |
style |
Format family of the preprocessed data. Currently only
|
encoding |
Character encoding of the preprocessed |
Details
Counterpart to import_sample_concentric_pre_to_fe_inventory.
Building the inventory objects can take a while for large forest units
(thousands of plots). Progress is reported through the progressr
framework, one step per plot. By default nothing is shown; wrap the call to
see a progress bar, and the same code drives a native Shiny progress bar
inside shiny::withProgress() / progressr::withProgressShiny():
progressr::handlers("cli")
progressr::with_progress(
inv <- import_standwise_relascope_pre_to_fe_inventory(input_path)
)
No height completion is performed here either, and missing heights are not
rejected: the returned inventory carries the measured heights as they are
(missing ones stay NA). Estimating them is a deliberate, separate
downstream step –
pull_trees() |> height_complete_inventory() |> fill_heights_back().
Value
An fe_inventory of fe_stand plots.
See Also
import_standwise_relascope_format1_raw_to_pre,
read_and_convert_data
Examples
# Build a preprocessed WZP_Daten.txt from the bundled Silvarith-style example,
# then read it into an fe_inventory.
sil_dir <- system.file("extdata", "data_ex6_standwise_raw", package = "FeNEU")
out_dir <- tempdir()
import_standwise_relascope_format1_raw_to_pre(sil_dir, output_dir = out_dir)
inv <- import_standwise_relascope_pre_to_fe_inventory(out_dir)
inv
Reference Tree Increment Data for Automated Tests (sub_10, rep_classic)
Description
Reference Tree Increment Data for Automated Tests (sub_10, rep_classic)
Details
Provided for automated testing. Contains the tree_increments
tibble produced by inv_increment_repsurv_ccirc with method
"rep_classic", applied to data_ex3_previous_sample_fe_inventory
(first survey) and data_ex3_sample_fe_inventory (second
survey), with match_type = "plot_id" and plot_id_style = "baysf".
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Reference Tree Increment Data for Automated Tests (sub_10, rep_end)
Description
Reference Tree Increment Data for Automated Tests (sub_10, rep_end)
Details
Provided for automated testing. Contains the tree_increments
tibble produced by inv_increment_repsurv_ccirc with method
"rep_end". See inc_sub10_rep_classic for details on
the input data.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Reference Tree Increment Data for Automated Tests (sub_10, rep_mean)
Description
Reference Tree Increment Data for Automated Tests (sub_10, rep_mean)
Details
Provided for automated testing. Contains the tree_increments
tibble produced by inv_increment_repsurv_ccirc with method
"rep_mean". See inc_sub10_rep_classic for details on
the input data.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Reference Tree Increment Data for Automated Tests (sub_10, rep_trans)
Description
Reference Tree Increment Data for Automated Tests (sub_10, rep_trans)
Details
Provided for automated testing. Contains the tree_increments
tibble produced by inv_increment_repsurv_ccirc with method
"rep_trans". See inc_sub10_rep_classic for details on
the input data.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
processed_heights_bav_sub10,
processed_heights_nfi_sub10,
processed_pulled_sub10
Inventory-Level Increment Base Table by Species Group and Age or Diameter Class
Description
Aggregates tree-level increments to the inventory level in the same
four-element layout as the static base_table_age_class /
base_table_d_q_class family, but for the annual volume increment
(iv_hub_m3_ha_yr) instead of standing volume. It is the increment
counterpart of the static base tables and the per-subunit breakdown analogue
of inv_inc_big_overview_matches_only.
Usage
increment_base_table(
tree_inc_extd,
by_class = c("age", "dq"),
tree_filter = TRUE
)
Arguments
tree_inc_extd |
Either an increment bundle – the output of
|
by_class |
Either |
tree_filter |
Expression describing which trees to keep, internally
passed to |
Details
The function operates on the per-tree increment frame produced by
inv_increment_repeated_survey (repeated survey) or
inv_increment_gnfi3 (single inventory). Both carry the
same per-tree contract, so the same base table is produced regardless of the
increment's origin. Internally the trees are first aggregated to plot level
with inv_inc_tree_2_plot, then area-weighted to the inventory
level via the shared primitive se_area_weighted_grouped.
This is the “plain” aggregation: each plot contributes its single
representation area (area_rep_ha); there is no split into virtual
monospecific areas (that is the job of a separate _main_stand variant).
The per-hectare values therefore relate to one hectare of total forest, and
the per-ha denominator is the full area across all plots in the input. Because
totals are linear in the per-plot values, the species rows of detail
sum (in iv_m3_yr_total) to the matching all_species row, and
total sums to all_total – the central sum-consistency invariant
(confidence intervals are not additive and are computed independently per
level).
Value
A list of four tibbles, mirroring the static base table family:
- detail
One row per species group and class.
- total
One row per species group, across all classes.
- all_species
One row per class, across all species groups (the body of the “Summe” block).
- all_total
One row, the grand total.
Each carries n_plot_class (the number of inventory points falling
into the group), the annual increment as both an absolute total
(iv_m3_yr_total) and per hectare of operation area
(iv_m3_ha_yr) with their 95% confidence half-widths
(ci95_*), and the counts n_iv_filled / n_iv_total
(gnfi3-estimated vs. total tree increments in the group). The plain table
carries no per-species area_ha (that is the main-stand variant's
job). The list additionally carries a collective
element (a list with kind, label, definition)
describing the tree collective the table represents: "all_layers"
for the default tree_filter, otherwise a "custom" collective
reporting the filter. It is carried through to the output and PDF steps so
the collective can be labelled without re-deriving it. A meta
element carries the header meta attached by inv_inc_tree_extend
(survey years, period, area, point count, Berechnungs-/Ergänzungsmethode),
or NULL for a single-inventory source.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
inv_b <- data_ex3_sample_fe_inventory
# Prepare a single inventory's tree data (warnings/messages are ok here)
inv_b_trees <- data_ex3_sample_trees_essentials
# Single-inventory increment, then the inventory base table
inc <- inv_increment_gnfi3(inv_b, inv_b_trees)
bt <- increment_base_table(inc, by_class = "age")
bt$detail
bt$all_total
Inventory-Level Main-Stand Increment Base Table With Virtual Species Areas
Description
Main-stand counterpart of increment_base_table: it restricts
the aggregation to the main stand (layer_key == 1, standing trees) and
expresses the per-hectare increment relative to the cohort's virtual
monospecific area rather than to one hectare of total forest. This mirrors
the static base_table_age_class_main_stand /
base_table_d_q_class_main_stand family. As there, species areas
are only formed for the main stand, because area shares of species in mixed
multi-layer stands are methodologically dubious (the same stance the Third
German National Forest Inventory took).
Usage
increment_base_table_main_stand(tree_inc_extd, by_class = c("age", "dq"))
Arguments
tree_inc_extd |
Either an increment bundle – the output of
|
by_class |
Either |
Details
The virtual areas are built exactly as on the static side: a per-plot correction factor normalises the plot's main-stand standing area to one hectare, and each cohort receives its standing-area share of the plot's representation area. Unlike the static side, the main stand here includes trees removed between the two inventories: their increment counts, and their (inv-1) standing area counts towards the ideal species area, so numerator and denominator span the same collective.
Because every tree that contributes increment also carries a positive standing area (removed trees at inv-1, surviving/ingrowth trees at inv-2), every group that appears has a positive ideal area – so the “species extinct but residual increment” edge case (division by a zero area) cannot arise. It also keeps strong species-share shifts (e.g. after a storm) from producing implausibly large per-ideal-hectare increments, because the removed area enters the denominator as well.
Value
A list of four tibbles (detail, total,
all_species, all_total) like increment_base_table
(with iv_m3_ha_yr and its CI over the whole operation area),
additionally holding area_ha (the ideal monospecific species area)
and iv_m3_ha_yr_virt (the increment per that ideal area, without a
CI). Unlike the static main-stand base tables it deliberately carries no
per-species area-share column (per_species): in the increment context
the ideal area is that of a period collective (including removed trees), so a
percentage share would be more misleading than informative. Like
increment_base_table, the list also carries a
collective element (here fixed to the "main_stand" collective,
“Hauptbestand”) and a meta element with the header meta
attached by inv_inc_tree_extend (NULL for a
single-inventory source).
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
inv_b <- data_ex3_sample_fe_inventory
inv_b_trees <- data_ex3_sample_trees_essentials
inc <- inv_increment_gnfi3(inv_b, inv_b_trees)
bt <- increment_base_table_main_stand(inc, by_class = "age")
bt$detail
bt$total
Main-Stand Yield-Table Increment Base Table by Species Group and Age or Diameter Class
Description
Yield-table (“Ertragstafel”) counterpart of
increment_base_table_main_stand. It breaks the yield-table
increment estimate down by species group and age or quadratic-mean-diameter
class, for the main stand only, and returns the same four-element layout as
the other increment base tables so it flows through
output_increment_base_table and
output_increment_base_table_pdf unchanged.
Usage
increment_ytables_base_table(
inv_dat,
ytable_selection,
by_class = c("age", "dq"),
plot_area_weight = TRUE,
fe_inv = NULL
)
Arguments
inv_dat |
Normally the result of |
ytable_selection |
A data frame assigning yield-table names to species,
e.g. |
by_class |
Either |
plot_area_weight |
Logical; if |
fe_inv |
Optional |
Details
Yield tables are age-indexed and their increment is expressed per hectare of a
(virtual) monospecific stand, so this table exists only for the main
stand and always relates to ideal species areas – there is no
“all layers” variant. Each species-group cohort on a plot receives its
yield-table increment (see inv_increment_ytables), which is then
aggregated to the inventory level. For by_class = "dq" the cohorts are
grouped by their quadratic mean diameter class (one per plot x species group,
as in back_table_dclass); the underlying per-cohort increment is
still the age-indexed yield-table value.
The confidence-interval columns are absent by design: only the repeated- inventory method carries an empirical CI.
Value
A list of four tibbles (detail, total,
all_species, all_total) plus a collective element (fixed
to “Hauptbestand”), a meta element (marking the source as
"ytable" so the PDF is titled “Ertragstafelschätzung”), and a
ytables_used element (the yield tables actually used, carried through
so the PDF can list them). Each
table carries n_plot_class, iv_m3_yr_total, iv_m3_ha_yr
(over the operation area), area_ha (ideal species area), and
iv_m3_ha_yr_virt (increment per ideal area). The per-species levels
(detail, total) additionally carry site_index (mean
Ertragsklasse); it is omitted from the cross-species all_species /
all_total block, where averaging a site index would be meaningless.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
inc <- inv_increment_ytables(
data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials,
ytables_bavrn_state_var_1_feneu
)
# Both axes rest on the same estimate
increment_ytables_base_table(inc, by_class = "age")$all_total
increment_ytables_base_table(inc, by_class = "dq")$all_total
Inventory-Wide Increment Overview for a Repeated Survey, Combining Matched and Second-Only Plots
Description
Top-level wrapper that runs both
inv_inc_big_overview_matches_only (for the plots that
appear in both surveys) and inv_inc_big_overview_2nd_only
(for the plots that only appear in the second survey, with a
short-window backward gnfi3 estimate) and combines their results into
one whole-enterprise view. Designed as the data source for
user-facing summary tables of the whole forest enterprise.
Usage
inv_inc_big_overview(
tree_inc_rep_gapfill,
inv_1st_trees,
inv_2nd_trees,
inv_2nd,
style = c("generic", "baysf"),
inc_summaric,
dt_2nd_only = -5
)
Arguments
tree_inc_rep_gapfill |
Output of
|
inv_1st_trees, inv_2nd_trees |
Tree data frames as in
|
inv_2nd |
|
style |
Passed through to
|
inc_summaric |
Output of |
dt_2nd_only |
Estimation period in years for the second-only
backward gnfi3 projection (negative for backward). Default
|
Details
Output layout (the central design decision): three sub-overview
slots that all keep the same internal shape ($overall +
$by_species_group), plus the inv_period and
method info passed through so downstream renderers can label
survey years and the increment method without re-deriving them.
- matches_only
Verbatim output of
inv_inc_big_overview_matches_only.- second_only
Verbatim output of
inv_inc_big_overview_2nd_only.- combined
Per-row addition of matches_only and second_only. One row per matched
fill_option(combined_standard,combined_min_estimates,combined_all_estimates,combined_inc_summaric), each summing the matched fill_option result with the singlegnfi3_backwardsecond_only contribution.iv_m3_yr_totalandarea_total_haare additive;iv_m3_ha_yris the resulting ratio. Sum-consistency: each combined row's totals equal the corresponding matches_only row plus the second_only row.- inv_period
The same
inv_periodlist element that is already carried byinv_increment_repsurv_ccircandinv_inc_fill_gaps_gnfi3, with the two survey years and the period length.- method
The increment method used in the upstream
inv_increment_repsurv_ccirccall (one of"rep_classic","rep_mean","rep_end","rep_trans"); carried through so user-facing renderers can label the table accordingly.
CI95 in $combined: the ci95_* columns are kept for
structural compatibility but are NA throughout. The
second_only contribution carries no empirical CI by contract (see
inv_inc_big_overview_2nd_only); an area-weighted
pooling of variances with one variance unknown would require
assumptions that we are not willing to make here. Users who need a
CI on the combined value can fall back to the matches_only CI as a
lower bound, and document the choice.
iv_by_groups in $combined is deliberately omitted.
The matched side breaks down by id_able_tree × tree_status
(categories that the second_only side does not share), so a mixed
breakdown would have a heterogeneous schema. Users that need that
detail should look at $matches_only$overall$iv_by_groups
separately.
Value
A list with the three top-level slots described above.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
suppressWarnings(suppressMessages({
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# Matching and gap filling are shipped ready-made for this pair
inc_rep <- data_ex3_increment_matched
inc_fl <- data_ex3_increment_fills
inc_sum <- inv_inc_summaric(
inc_rep$tree_increments, inc_fl$fills_forward,
inv_a_trees, inv_b_trees
)
}))
bo <- inv_inc_big_overview(
inc_fl, inv_a_trees, inv_b_trees, inv_b,
style = "generic", inc_summaric = inc_sum
)
bo$combined$overall$iv_total
Inventory-Wide Increment Overview for Plots Only Present in the Second Inventory
Description
Counterpart to inv_inc_big_overview_matches_only for those plots that
only appear in the second survey (typical case: sample extensions and
newly established plots between two inventories). Their increment cannot
be observed directly; it is estimated per tree by applying the
third-German-NFI growth functions backwards over a short period
(dt, default 5 years) and aggregating across plots with the same
area-weighted machinery as in inv_inc_big_overview_matches_only.
Usage
inv_inc_big_overview_2nd_only(inc_repinv_fl, inv_2nd_trees, inv_2nd, dt = -5)
Arguments
inc_repinv_fl |
Output of |
inv_2nd_trees |
Tree data frame from the second inventory, as
produced by |
inv_2nd |
The corresponding |
dt |
Estimation period for the backward gnfi3 projection, in years,
passed through to |
Details
Why a short period and not the full inter-survey distance: on plots without a previous observation we do not know the mortality and removal history. A backward projection over ~10 years would attribute much of the standing volume to "still living" trees and miss the unknown fraction that would actually have died or been harvested in that span. Over a shorter window (~5 years) that bias stays small and the resulting per-year growth rate is a defensible estimate for the representative area of the second-only plots.
The output structure mirrors inv_inc_big_overview_matches_only so that
the two can later be combined into one whole-enterprise table by the
caller. There is, however, no fill_option dimension here: only
one estimator is in play (backward gnfi3 over dt years). A single
label "gnfi3_backward" is used in the fill_option column
so that a row bind with the matched-plots output stays unambiguous.
Current scope and limitations (v1):
Only living trees of the second inventory enter the estimate (filter
!removal). Removal trees on second-only plots are ignored; their contribution to the period increment would need a separate mortality model and is left out for now.The estimate is therefore a "living-tree backward" growth quantity, not a full balance increment. Be careful when combining the per-ha results with the matched-plot
inc_summaricreference value, which does include mortality.-
The
ci95_*columns are present for structural compatibility withinv_inc_big_overview_matches_onlybut containNAthroughout. All per-plot increments here come from a model (backward gnfi3 over a short window), not from empirical re-measurement; the only source of plot-to-plot scatter is then what the model itself produces on top of the actual tree sample. A confidence interval computed from that scatter would suggest a precision the underlying numbers do not have. Downstream code that merges this output with the matched-plots overview must therefore treat the 2nd-only CI columns as missing-on-purpose.
Value
A list with the same top-level structure as
inv_inc_big_overview_matches_only: $overall (containing
iv_by_groups, iv_total, v_total, n_plots)
and $by_species_group (containing iv_by_groups,
iv_total, v_total). All m3/ha values relate to the
total area across all second-only plots, even when grouped by
species; plots without trees of a given species_group contribute
their area but a zero numerator, so sums of per-species values
match the corresponding overall values.
If there are no second-only plots, an empty-shaped list is returned
with zero rows in the tables and area_total_ha = 0 in
n_plots; this lets downstream combination code merge the two
overviews without special-casing.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
suppressWarnings(suppressMessages({
# Matching and gap filling are shipped ready-made for this pair
inc_rep <- data_ex3_increment_matched
inc_fl <- data_ex3_increment_fills
}))
bo_2nd <- inv_inc_big_overview_2nd_only(inc_fl, inv_b_trees, inv_b)
bo_2nd$overall$iv_total
bo_2nd$by_species_group$iv_total
Inventory-Wide Increment Overview for the Matched Plots of a Repeated Survey
Description
Produces the area-weighted increment overview from those plots that
appear in both inventories — i.e. the subset for which repeated
tree-level measurements are available. The companion function
inv_inc_big_overview_2nd_only covers the plots that only
exist in the second survey (new establishments, sample extensions);
the top-level inv_inc_big_overview_matches_only combines both.
Usage
inv_inc_big_overview_matches_only(
tree_inc_rep_gapfill,
inv_1st_trees,
inv_2nd_trees,
inv_2nd,
style = c("generic", "baysf"),
inc_summaric
)
Arguments
tree_inc_rep_gapfill |
Output object of
|
inv_1st_trees |
Tree data frame as pulled and extended from the the
|
inv_2nd_trees |
Tree data frame as pulled and extended from the the
|
inv_2nd |
|
style |
Two options
|
inc_summaric |
Output of |
Value
A list with three top-level elements:
- overall
A sub-list with
- iv_by_groups
Increments aggregated by fill_option, tree identification status, and tree status category
- iv_total
Total increments per fill_option, plus an additional row
"inc_summaric"with the summaric (yield-history) increment as the most reliable reference value- v_total
Total standing volume at the second inventory
- n_plots
Number of plots and total represented area
- by_species_group
A sub-list with the same structure as
overall(minusn_plots, which would be redundant), but every tibble is additionally grouped byspecies_group. The total area (area_total_ha) stays at the area across all plots, so that plots without trees of a given species group still contribute their area to the denominator. Consequently, sums of per-species values (iv_m3_yr_total,iv_m3_ha_yr,v_hub_m3_ha) across species groups match the corresponding overall values, and the same applies row by row to the appended"inc_summaric"entries.- method
The increment method used in the upstream
inv_increment_repsurv_ccirccall (carried throughinv_inc_fill_gaps_gnfi3).
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
# Identify two subsequent inventories
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# Matching and gap filling for this pair are shipped ready-made, see
# ?data_ex3_increment_interim for how they were built
inc_repinv <- data_ex3_increment_matched
inc_repinv_fl <- data_ex3_increment_fills
# Compute the summaric increment per plot (required for big_overview).
# Note: summaric reads matched_trees and fills_forward directly — it
# does NOT go through the consolidate / extend per-tree pipeline,
# so its balance always sees the full measured population.
inc_sum <- inv_inc_summaric(
inc_repinv$tree_increments, inc_repinv_fl$fills_forward,
inv_a_trees, inv_b_trees
)
# Finally generate the matched-plots overview, use both styles
inv_inc_big_overview_matches_only(
inc_repinv_fl, inv_a_trees, inv_b_trees, inv_b,
style = "generic", inc_summaric = inc_sum
)
inv_inc_big_overview_matches_only(
inc_repinv_fl, inv_a_trees, inv_b_trees, inv_b,
style = "baysf", inc_summaric = inc_sum
)
Backward-Estimate Increments for Implausible Re-Measured Trees
Description
Called from within inv_inc_fill_gaps_gnfi3. Handles trees that
were present in both inventories but flagged as implausible during tree
matching (due to excessive volume shrinkage or species mismatch). These trees
received a zero increment from the repeated measurement and need a
model-based backward estimate. The second inventory's values are taken as
ground truth and the increment is estimated backwards for the whole inventory
period. The single tree increments are upscaled to an area of 1 ha.
Usage
inv_inc_fill_backward_implausible(tree_inc_rep, inv_2nd_trees)
Arguments
tree_inc_rep |
See entry at |
inv_2nd_trees |
See entry at |
Value
The data frame tree_inc_rep$tree_increments filtered for
implausible re-measured trees. It contains the two additional columns
iv_hub_m3_ha_per_gnfi3, and iv_hub_m3_ha_yr_gnfi3 which
represent the periodic and the mean annual backward estimates of their
volume increment.
Backward-Estimate Increments for Trees That Were Measured in Both Inventories (Optional)
Description
Called from within inv_inc_fill_gaps_gnfi3. Covered are
all trees that were present and matching in both inventories as long as
they have no removal flag for the second inventory. In principle,
there are no increment gaps to fill for these trees. However, it might be
useful to compare estimates and real increments under certain circumstances.
Note that the tree level increments are upscaled to an area of 1 ha. Hereby,
we use the real representation numbers of each tree at the first and the
second survey, i.e. we do not check whether the growth estimate crossed a
representation threshold. Negative increments are possible and not wrong.
Usage
inv_inc_fill_backward_reptrees(tree_inc_rep, inv_2nd_trees, include_reptrees)
Arguments
tree_inc_rep |
See entry at |
inv_2nd_trees |
See entry at |
include_reptrees |
If |
Value
A data frame with the same structure as the output of
the other fill-gap functions. However only if the parameter
include_reptrees is set on TRUE, the backwards estimates will
actually be calculated (which can take considerable time). Otherwise, the
columns reserved for the estimates will be filled with NA values.
Backward-Estimate Increments for Trees that were Present in the Second of Two Subsequent Inventories
Description
Called from within inv_inc_fill_gaps_gnfi3.
Takes into account only trees that have coordinates, but were only present
in the second inventory. A backward estimate of the
volume increment is done for the whole inventory period. The idea behind this
approach: When crossing the diameter threshold of their circle between both
inventories, these trees became eligible for survey, but they were actually
growing for the whole inventory period. The single tree increments are
upscaled to an area of 1 ha.
Usage
inv_inc_fill_gaps_backward(tree_inc_rep, inv_2nd_trees)
Arguments
tree_inc_rep |
See entry at |
inv_2nd_trees |
See entry at |
Value
The data frame tree_inc_rep$tree_increments filtered for
trees that are only existing in the second inventory. It contains the two
additional columns iv_hub_m3_ha_per_gnfi3, and
iv_hub_m3_ha_yr_gnfi3 which represent the periodic and the mean
annualbackward estimates of their volume increment.
Backward-Estimate Increments for Trees That Cannot Be Matched Across Inventories
Description
Called from within inv_inc_fill_gaps_gnfi3. Takes into
account only trees from the second inventory that cannot be matched across
inventories due to the implemented survey system. Typically, such trees
are below a certain dbh threshold and therefore not surveyed in a way that
would make them uniquely identifyable. These trees obtain a backward estimate
of their volume increment. The single tree increments are upscaled to an area
of 1 ha.
Usage
inv_inc_fill_gaps_backward_nomatch(tree_inc_rep, inv_2nd_trees)
Arguments
tree_inc_rep |
See entry at |
inv_2nd_trees |
See entry at |
Value
A data frame with the same structure as
tree_inc_rep$tree_increments, however containg only trees that are
not present in this data frame but present in the second inventory. These
are trees that cannot be matched in subsequent inventories due to the
survey system implemented. Therefore, increments from repeated inventories
are not available for these trees. Consequently, the columns
iv_hub_m3_ha_per_rep and iv_hub_m3_ha_yr_rep contain
NA only. However, The columns iv_hub_m3_ha_per_gnfi3 and
iv_hub_m3_ha_yr_gnfi3 contain backwards estimates of their volume
increment.
Forward-Estimate Increments for Trees that were Present in the First of Two Subsequent Inventories
Description
Called from within inv_inc_fill_gaps_gnfi3.
Takes into account only trees that have coordinates, but were only present
in the first inventory, or present in the second inventory but with a
removal flag. A forward estimate of the volume increment is done
for half the inventory period, as such trees are assumed to have died or
have been harvested at the middle of the period. The mean annual increment
relates to the full inventory period as it has to represent the trees'
contribution to the mean annual increment on the stand level. The single tree
increments are upscaled to an area of 1 ha.
Usage
inv_inc_fill_gaps_forward(tree_inc_rep, inv_1st_trees)
Arguments
tree_inc_rep |
See entry at |
inv_1st_trees |
See entry at |
Value
The data frame tree_inc_rep$tree_increments filtered for
trees that are only existing in the first inventory. It contains the two
additional columns iv_hub_m3_ha_per_gnfi3, and
iv_hub_m3_ha_yr_gnfi3 which represent the periodic and the mean
annual forward estimates of their volume increment.
Close Tree Increment Gaps with Estimates from National Forest Inventory Functions
Description
When calculating tree level increments from two subsequent inventories, there
are typically trees that were present in one of the inventories only. For
different types of such trees, we apply here the single tree growth
functions from the third German National Forest Inventory
(Riedel et al. 2017) as implemented
in the Package ForestElementsR, namely the functions
d_age_gnfi3 and
h_age_gnfi3.
Usage
inv_inc_fill_gaps_gnfi3(
tree_inc_rep,
inv_1st_trees,
inv_2nd_trees,
include_reptrees = TRUE
)
Arguments
tree_inc_rep |
Output of |
inv_1st_trees |
Extended tree data frame for the first inventory,
exactly as it was used as an input to
|
inv_2nd_trees |
Extended tree data frame for the second inventory,
exactly as it was used as an input to
|
include_reptrees |
If |
Details
The increment estimates performed here are only applied to inventory plots
that match in both inventories. This is guaranteed by requiring
tree_inc_rep as input object. This is the output of
inv_increment_repsurv_ccirc which ensures plot matching.
Value
A list comprising five data frames that have exactly the same
structure, i.e. the same columns as tree_inc_rep$tree_increments,
however with two additional columns,iv_hub_m3_per_gnfi3, and
iv_hub_m3_yr_gnfi3). The data frame fills_forward relates to
trees that were present in the first, but missing in the second inventory.
Their increment is projected forward up to the mid of the period between
both inventories. The second data frame fills_backward comprises
trees that were present in the second, but not present in the first
inventory. Their increment is estimated backwards for the whole period. The
third data frame fills_backward_nomatch comprises trees present
in the second inventory, which were, however, not recorded in a way that
makes them identifyable in the first inventory (typically, such trees are
under a certain dbh threshold). For such trees backward increment estimates
are made for the whole period. The fourth data frame
fills_backward_implausible comprises trees that were present in both
inventories but flagged as implausible during tree matching (due to
excessive volume shrinkage or species mismatch). These trees received a
zero increment from the repeated measurement; their increment is estimated
backwards from the second inventory's values for the whole period. The
fifth data frame fills_backward_reptrees relates to plausible trees
that were present in both inventories. While directly calculated increments
are available for these trees, backward estimates are calculated if
(include_reptrees) is TRUE. This might only be required under
special circumstances, therefore, the default setting is FALSE
for saving time. In the latter case, the columns reserved for the
increment estimates are set to NA. In addition the list contains the
elements inv_period (carried through from
inv_increment_repsurv_ccirc), plot_matches
(the plot match overview, also from inv_increment_repsurv_ccirc;
downstream consumers such as
inv_inc_big_overview_2nd_only use the
in_b_only entry there to identify plots that only appear in the
second inventory), and method (the increment method used in
the upstream inv_increment_repsurv_ccirc call –
one of "rep_classic", "rep_mean", "rep_end",
"rep_trans").
References
Riedel T, Hennig P, Kroiher F, Polley H, Schmitz F, F. S (2017). Die dritte Bundeswaldinventur (BWI 2012). Inventur- und Auswertungsmethoden. Thuenen Institut fuer Waldoekosysteme.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
# Identify two subsequent inventories
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# The matching this builds on is shipped ready-made for the pair, see
# ?data_ex3_increment_interim
inc_repinv <- data_ex3_increment_matched
# Finally, fill the gaps. include_reptrees = FALSE estimates only where
# there is a gap; the default TRUE also estimates for trees measured
# twice, which is what fill_option = "all_estimates" later feeds on.
inv_inc_fill_gaps_gnfi3(
inc_repinv, inv_a_trees, inv_b_trees, include_reptrees = TRUE
)
Compute the Summaric Increment per Plot, Overall and by Species Group
Description
Computes a pure balance increment per plot that does not require any tree
matching assumptions. The formula is:
inc_summaric = (V_end - V_start + V_removed) / period, where
V_end is the total standing volume at the second inventory (excluding
removed trees), V_start is the total standing volume at the first
inventory, and V_removed is the forward-estimated volume of trees
that were removed between inventories. The forward estimation relies on
gnfi3-based estimates from the "standard" fill option, which is why the
input must come from inv_inc_tree_consolidate with
fill_option = "standard", extended by
inv_inc_tree_extend.
Usage
inv_inc_summaric(matched_trees, fills_forward, inv_1st_trees, inv_2nd_trees)
Arguments
matched_trees |
Data frame, the |
fills_forward |
Data frame, the |
inv_1st_trees |
Tree data frame as pulled and extended from the
first |
inv_2nd_trees |
Tree data frame for the second inventory. Used for the species-group lookup of trees that exist in the second inventory (the dominant case — both-exist trees, ingrowth, and unmatchable inv-2). |
Details
The classical German forestry term for this quantity is "ertragsgeschichtlicher Zuwachs" (literally: yield-history increment). There is no established English equivalent; we use the term "summaric increment" here to express that this increment is derived purely from summary-level volume balances between two inventories, without relying on individual tree identity across surveys.
Methodological role. The ertragsgeschichtliche increment is the
Goldstandard for the Betriebsebenen-Zuwachs — the best estimate of
the enterprise-wide annual increment that two inventories can yield.
Unlike the four single-tree methods (rep_classic, rep_mean,
rep_end, rep_trans) it is a pure mass balance over the
measured tree population; it does not depend on assumptions about
which inventory's representation number to use for trees that change
circles, and it does not need a per-tree pairing across inventories.
For that reason it stands architecturally apart from the per-tree
pipeline (inv_inc_tree_consolidate and
inv_inc_tree_extend): summaric pulls its inputs
(matched_trees, fills_forward, and the inv-trees lookups
for species groups) directly, so its balance always sees the full
measured population including the unmatchable inner-circle cohort —
independent of any fill_option choice on the per-tree side.
Computational structure on each plot:
-
v_hub_m3_ha_1st: sum ofn_rep_ha_1st * v_hub_m3_1stover all inv-1 measurements present inmatched_trees, including the rows flaggedis_unmatchable_1st = TRUE(e.g. inner-circle trees recorded without polar coordinates). -
v_hub_m3_ha_2nd: sum ofn_rep_ha_2nd * v_hub_m3_2ndover all living inv-2 measurements (no removal flag), including unmatchable inv-2 rows and the inv-2 records of pseudo-ingrowth- reclassified trees (the latter contribute only their inv-2 volume after the local undo described below). -
v_hub_m3_ha_aus: sum ofn_rep_ha_1st * v_hub_m3_1stplus the half-period gnfi3 forward estimate, over the verified-ausscheider subset (tree_exists_1stis TRUE and eithertree_exists_2ndis FALSE or the tree carries a removal flag at inv 2). The forward estimate is pulled fromfills_forward. Unmatchable rows have NA on the counterpart side and are filtered out by NA-semantics so they never inflatev_aus.
Pseudo-ingrowth-reclassified trees have their reclassification locally undone inside summaric so that their inv-1 reconstruction (gnfi3 backward) does not enter the balance. They contribute only via their measured inv-2 volume — exactly the methodological treatment we want for the unmatchable inner-circle cohort.
Value
A list with two tibbles:
- overall
One row per plot, columns
plot_id,v_hub_m3_ha_1st,v_hub_m3_ha_2nd,v_hub_m3_ha_aus,inc_summaric_m3_ha_yr.- by_species_group
One row per (plot, species_group) combination, same volume / increment columns as
overallplusspecies_group. Combinations where a species group is absent on a plot are not represented; consumers that need a complete grid (e.g. for area-weighted aggregation across all plots) must fill in zeros.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
# Identify two subsequent inventories
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
# Pull and prepare tree data
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# Matching and gap filling for this pair are shipped ready-made, see
# ?data_ex3_increment_interim for how they were built
inc_repinv <- data_ex3_increment_matched
inc_repinv_fl <- data_ex3_increment_fills
# Summaric goes directly off matched_trees + fills_forward —
# no consolidate / extend in between.
inv_inc_summaric(
inc_repinv$tree_increments,
inc_repinv_fl$fills_forward,
inv_a_trees, inv_b_trees
)
Aggregate Single Tree Increments to ha-Values per Species Group, Age- or Diameter Class and Layer on Plot Level
Description
The ha-related values calculated here are to be understood as the
contributions of each tree cohort (as defined by species group, (age- or
diameter-) class, and layer) to the whole ha-wise increment of the plot.
Importantly, they do not relate to virtual area shares of the cohorts.
In an increment evaluation workflow, the intended use of this function is to
be applied to the output of
inv_inc_tree_extend
Usage
inv_inc_tree_2_plot(tree_inc_extd, by_class = c("age", "dq"))
Arguments
tree_inc_extd |
Data frame, output of |
by_class |
Two options "age" (default), and "dq", which will aggregate the increments by age-, and mean diameter classes, respectively. |
Value
A data frame with increment sums grouped by plot_id,
species_group, d_q_class or age_class,
layer_key, removal
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
# Identify two subsequent inventories
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# Matching and gap filling for this pair are shipped ready-made, see
# ?data_ex3_increment_interim for how they were built
inc_repinv <- data_ex3_increment_matched
inc_repinv_fl <- data_ex3_increment_fills
# Consolidate and extend tree increments
inc_repinv_ce <- inv_inc_tree_consolidate(inc_repinv_fl) |>
inv_inc_tree_extend(inv_a_trees, inv_b_trees, inv_b)
# Finally, aggregate on plot level
inv_inc_tree_2_plot(inc_repinv_ce, "age")
inv_inc_tree_2_plot(inc_repinv_ce, "dq")
Consolidating a Mix of Real and Estimated Tree-Level Increments for Further Processing
Description
In an increment evaluation workflow, the intended use of this function is to
be applied to the output of
inv_inc_fill_gaps_gnfi3. In parallel to the
increment values that were directly calculated, the latter has estimated
the increment with the tree growth functions from the Third German National
Forest Inventory (Riedel et al. 2017) for different
cohorts of trees (in different ways, see
inv_inc_fill_gaps_gnfi3). Here, the user decides which
increments to use for which cohort in subsequent evaluations.
Usage
inv_inc_tree_consolidate(
tree_inc_rep_gapfill,
fill_option = c("standard", "min_estimates", "all_estimates")
)
Arguments
tree_inc_rep_gapfill |
Output object of
|
fill_option |
Three options, "standard" (default), "min_estimates", and "all_estimates". See Details. |
Details
The fill_option "standard" takes the inventory increment for all
trees that can be potentially identified across inventories and are present
at least in the second survey (i.e. re-measured or ingrown), as long as they
do not have a removal flag at the second survey. For such trees
that are, however, present in the first survey but are absent or have a removal
flag at the second survey, an NFI based forward increment estimate for half
the period between the surveys is used. Trees that cannot be identified
across inventories and are present in the second survey, obtain a backwards
increment estimate for the whole period. The option "min_estimates" uses
NFI estimates only for trees that cannot be identified across surveys.
Therefore, trees that only exist in the first survey obtain a zero increment.
The third option "all_estimates" uses NFI based estimates for all trees.
Value
A data frame with every line representing a tree, actually all
output components from inv_inc_fill_gaps_gnfi3 combined
into one data frame. Importantly, there are three additional columns:
iv_hub_m3_per and iv_hub_m3_yr are the periodic and annual
increment values to continue calculating with (coming either from the
inventory or from the estimate), and iv_filled is logical; if
TRUE, the increment is estimated with the German NFI growth functions.
If FALSE the increment is directly calculated from the survey data.
References
Riedel T, Hennig P, Kroiher F, Polley H, Schmitz F, F. S (2017). Die dritte Bundeswaldinventur (BWI 2012). Inventur- und Auswertungsmethoden. Thuenen Institut fuer Waldoekosysteme.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
# Identify two subsequent inventories
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# Matching and gap filling for this pair are shipped ready-made, see
# ?data_ex3_increment_interim for how they were built
inc_repinv <- data_ex3_increment_matched
inc_repinv_fl <- data_ex3_increment_fills
# Finally, consolidate the tree increments, try all fill options
inv_inc_tree_consolidate(inc_repinv_fl, fill_option = "standard")
inv_inc_tree_consolidate(inc_repinv_fl, fill_option = "min_estimates")
inv_inc_tree_consolidate(inc_repinv_fl, fill_option = "all_estimates")
# The option 'all_estimates' must throw an error if the gap filling was
# not done for the trees which have dbh values in both surveys
inc_repinv_fl <- inv_inc_fill_gaps_gnfi3(
inc_repinv, inv_a_trees, inv_b_trees, include_reptrees = FALSE
)
try(
inv_inc_tree_consolidate(inc_repinv_fl, fill_option = "all_estimates")
)
Extend Tree-Level Increments With Detailed Tree Information, Especially Age and Mean Diameter Classes for Further Aggregation
Description
In an increment evaluation workflow, the intended use of this function is to
be applied to the output of inv_inc_tree_consolidate
Usage
inv_inc_tree_extend(
tree_inc_cons,
inv_1st_trees,
inv_2nd_trees,
inv_2nd,
d_q_interval = 10
)
Arguments
tree_inc_cons |
A data frame with consolidated tree level increments,
typically the output of |
inv_1st_trees |
Tree data frame as pulled and extended from the the
|
inv_2nd_trees |
Tree data frame as pulled and extended from the the
|
inv_2nd |
|
d_q_interval |
Numeric value, represents the width (cm) of the
quadratic mean diameter (d_q) classes to be added to the output data frame.
This argument is passed to the function |
Value
A data frame where each row represents a tree, with extended
information about increment and other tree level variables. The two
columns time_yr_prev and time_yr_2nd are uniform across
all rows and describe the survey years of the inventory pair (1st and
2nd survey, respectively); their difference is the inter-survey
period. time_yr is the time of the tree's actual observation
in the join partner inventory and equals time_yr_prev for trees
that exist only in the first survey. The result also carries an
"inc_meta" attribute (survey years, period, area, point count,
Berechnungs-/Ergänzungsmethode) that the increment base tables promote
into their header meta block.
Coverage – read this before aggregating
The result covers only the plots measured in both inventories. Plots
that exist just in the second survey are not part of the repeated-survey
matching and therefore absent here. Feeding this frame straight into
increment_base_table or
increment_base_table_main_stand understates every
per-hectare figure, because those tables divide by the full operation area
(from the "inc_meta" attribute) while the second-only plots contribute
no increment – their area sits in the denominator with nothing in the
numerator. Pass the result through
inv_inc_tree_extend_combined first, or, simpler, use
inv_increment_repeated_survey, which runs the whole chain
including that step.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
# Identify two subsequent inventories
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# Matching and gap filling for this pair are shipped ready-made, see
# ?data_ex3_increment_interim for how they were built
inc_repinv <- data_ex3_increment_matched
inc_repinv_fl <- data_ex3_increment_fills
# Consolidate tree increments
inc_repinv_cons <- inv_inc_tree_consolidate(inc_repinv_fl)
# Extend with tree information required for further aggregation
inv_inc_tree_extend(inc_repinv_cons, inv_a_trees, inv_b_trees, inv_b)
Fold Second-Only Plots Into the Repeated-Survey Tree-Level Increments
Description
Extends the per-tree increment frame of a repeated survey – the output of
inv_inc_tree_extend, which covers only the plots measured in
both inventories – with the plots that exist only in the second survey
(new establishments, sample extensions). These second-only plots receive a
short-window backward gnfi3 estimate via
inv_inc_tree_extend_single (default dt = -5, the same
convention as inv_inc_big_overview_2nd_only), and the two
per-tree frames are row-bound into one.
Usage
inv_inc_tree_extend_combined(
tree_inc_extd,
inc_repinv_fl,
inv_2nd_trees,
dt = -5,
d_q_interval = 10
)
Arguments
tree_inc_extd |
Per-tree increment frame of the matched plots, the
output of |
inc_repinv_fl |
Output of |
inv_2nd_trees |
Tree data frame of the second survey (as pulled,
height-completed and passed through |
dt |
Time span (years) for the second-only backward gnfi3 estimate,
passed to |
d_q_interval |
Numeric, width (cm) of the quadratic mean diameter (d_q)
classes, passed on to |
Details
The point of this function is the shared per-tree contract: both
inv_inc_tree_extend and inv_inc_tree_extend_single
emit the same columns consumed by inv_inc_tree_2_plot, so the
combined frame runs through increment_base_table and
increment_base_table_main_stand unchanged. The resulting
base tables then cover the whole enterprise (matched plus second-only
plots) instead of only the matched subset, so their per-hectare increment
relates to the full operation area – consistent with the enterprise-level
inv_inc_big_overview (where
combined = matches_only + second_only).
Only living trees (!removal) of the second-only plots enter the
estimate, mirroring inv_inc_big_overview_2nd_only: a plot without
a predecessor survey has no between-inventory removals to capture, so a removal
flag there marks a tree that is not part of the period's standing increment.
The matched frame is left exactly as it is (it keeps its removed trees, whose
increment is part of the period's production – the “Weg B” convention).
The header meta carried by tree_inc_extd already describes the whole
enterprise (its area and point count come from the full second inventory
passed to inv_inc_tree_extend), so it is simply re-attached to
the combined frame (row-binding drops attributes).
Value
A per-tree increment data frame with the same contract as
inv_inc_tree_extend, now spanning matched and second-only
plots, carrying the (whole-enterprise) "inc_meta" attribute of
tree_inc_extd. If there are no second-only plots (or none with living
trees), tree_inc_extd is returned unchanged.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
# Identify two subsequent inventories
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
suppressWarnings(suppressMessages({
# Matching and gap filling are shipped ready-made for this pair
inc_rep <- data_ex3_increment_matched
inc_fl <- data_ex3_increment_fills
inc_extd <- inv_inc_tree_consolidate(inc_fl) |>
inv_inc_tree_extend(inv_a_trees, inv_b_trees, inv_b)
}))
# Fold in the second-only plots -> whole-enterprise per-tree frame
inc_extd_all <- inv_inc_tree_extend_combined(
inc_extd, inc_fl, inv_b_trees
)
# Base tables now cover matched + second-only plots (run unchanged)
increment_base_table(inc_extd_all, by_class = "age")$all_total
Extend Single-Inventory gnfi3 Tree Increments With Detailed Tree Information for Further Aggregation
Description
Single-inventory counterpart to inv_inc_tree_extend. Where the
latter consolidates a repeated survey (with its match-based and gnfi3-filled
increments) into the per-tree contract consumed by
inv_inc_tree_2_plot, this function produces the very same
contract for an inventory that was not repeated. Every tree increment
is estimated with the Third German National Forest Inventory growth functions
(Riedel et al. 2017) via tree_inc_gnfi_2012,
so the resulting iv_filled column is uniformly TRUE.
Usage
inv_inc_tree_extend_single(
inv_trees,
dt = 5,
d_q_interval = 10,
inv = NULL,
.caller = "inv_inc_tree_extend_single"
)
Arguments
inv_trees |
Tree data frame as pulled from an |
dt |
Time span for the gnfi3 estimate (years), passed to
|
d_q_interval |
Numeric, width (cm) of the quadratic mean diameter (d_q)
classes added to the output. Passed to |
inv |
Optional |
.caller |
Name the age check reports as the failing function. Defaults
to this function's own name; |
Details
The point of this function is the shared seam: once the single-inventory
source carries the same columns as the repeated-survey source, the downstream
aggregation (inv_inc_tree_2_plot and everything built on top of
it) is written and maintained only once, regardless of where the increment
came from. The estimation method (gnfi3) is reflected in the per-tree
_gnfi3 columns that ride along; the per-ha increment that the contract
uses (iv_hub_m3_ha_yr) is the per-tree value scaled by
n_rep_ha, clamped at zero (negative differences are improbable but
possible near age 0).
The estimation direction lives in the sign of dt (see
tree_inc_gnfi_2012). The default dt = 5 looks five years
forward: for a single inventory the planning perspective is inherently
forward-looking, so the increment of the coming years is the quantity of
interest. The backward convention dt = -5 used by
inv_inc_big_overview_2nd_only addresses a different situation –
there the gnfi3 estimate stands in for a repeated survey, whose view is
naturally backward (in the assumption that the recent past increment is a
good proxy for the coming years). Either way a short window keeps the bias
from the unknown future or past mortality and removal history small.
Value
A data frame where each row represents a tree, carrying the per-tree
increment contract consumed by inv_inc_tree_2_plot:
plot_id, species_group, age_class, d_q_class,
layer_key, removal, standing_area_m2, n_rep_ha,
area_rep_ha, the periodic and annual per-ha increments
iv_hub_m3_ha_per / iv_hub_m3_ha_yr, and iv_filled
(always TRUE here). The per-tree _gnfi3 estimation columns
from tree_inc_gnfi_2012 are retained.
References
Riedel T, Hennig P, Kroiher F, Polley H, Schmitz F, F. S (2017). Die dritte Bundeswaldinventur (BWI 2012). Inventur- und Auswertungsmethoden. Thuenen Institut fuer Waldoekosysteme.
Estimate the Volume Increment of a Single Inventory With the BWI 3 Growth Functions
Description
Covers the whole chain from a prepared tree list to a ready-to-aggregate
increment result, using the single-tree growth functions of the third German
National Forest Inventory (Riedel et al. 2017). It is the
single-inventory counterpart of
inv_increment_repeated_survey: both return the same kind of
object, so everything downstream – the increment base tables, the overview,
and their PDF reports – is served in exactly the same way.
Usage
inv_increment_gnfi3(
inv,
inv_trees,
dt = 5,
d_q_interval = 10,
keep_steps = FALSE
)
Arguments
inv |
An |
inv_trees |
Tree data frame as pulled from |
dt |
Time span in years the estimate spans. Positive values look forward, negative values backward. Default is five years; the further such an estimate reaches, the less it can account for removals, mortality and ingrowth. |
d_q_interval |
Width of the quadratic mean diameter classes in cm,
passed to |
keep_steps |
Logical. If |
Details
The increment is estimated per tree and for the whole population, not
only for the collective that happens to be reported afterwards. Any
collective can therefore be aggregated from the result: the main stand, all
layers, or a selection of your own via the tree_filter argument of the
base-table functions.
Because the estimate ages each tree by dt years, the age of every tree
is required. If ages are missing, the function stops rather than silently
evaluating the part of the population that happens to carry one.
Value
An object of class fe_increment_gnfi3, which inherits from
fe_increment. A list with the elements
- trees
the per-tree increments, covering all layers,
- overview
the aggregation to inventory level, overall and by species group,
- meta
the figures the reports print in their header,
- steps
the intermediate results, or
NULL(seekeep_steps).
References
Riedel T, Hennig P, Kroiher F, Polley H, Schmitz F, F. S (2017). Die dritte Bundeswaldinventur (BWI 2012). Inventur- und Auswertungsmethoden. Thuenen Institut fuer Waldoekosysteme.
See Also
inv_increment_repeated_survey for the repeated-survey
counterpart, increment_base_table and
increment_base_table_main_stand for the class tables,
output_increment_overview_gnfi3 for the species-group
overview.
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
inc <- inv_increment_gnfi3(
inv = data_ex3_sample_fe_inventory,
inv_trees = data_ex3_sample_trees_essentials
)
inc
# Increment of the whole inventory, m3 per hectare and year
inc$overview$overall$iv_total$iv_m3_ha_yr
# Broken down by species group and age class
increment_base_table(inc, by_class = "age")$all_total
Estimate the Volume Increment With the 3rd German National Forest Inventory Tree Growth Functions by Species and Age Class for a Whole Forest Inventory
Description
Uses the single tree growth functions developed for the third German
National Forest Inventory (Riedel et al. 2017) as
implemented in the package ForestElementsR, namely the functions
d_age_gnfi3, and
d_age_gnfi3
Usage
inv_increment_gnfi_2012(inv_dat, dt = 5, plot_area_weight = TRUE)
Arguments
inv_dat |
Tree data frame as pulled from an |
dt |
Time span to be applied for the increment estimation. Default is five years. |
plot_area_weight |
Logical, if TRUE (default), the single plots are weighted with the area they represent. If FALSE all plots are equally weighted |
Value
A data frame with ha-wise annual volume increments and virtual areas per species group and age class, for the main stand only and per virtual monospecific hectare
References
Riedel T, Hennig P, Kroiher F, Polley H, Schmitz F, F. S (2017). Die dritte Bundeswaldinventur (BWI 2012). Inventur- und Auswertungsmethoden. Thuenen Institut fuer Waldoekosysteme.
Increment From a Repeated Inventory – the Whole Chain in One Call
Description
Calculates the volume increment of a pair of subsequent inventories and
returns everything the output functions need. This is the standard entry
point for the repeated-survey increment (“Verfahren 1”): it runs the
six-step chain
inv_increment_repsurv_ccirc ->
inv_inc_fill_gaps_gnfi3 ->
inv_inc_tree_consolidate ->
inv_inc_tree_extend ->
inv_inc_tree_extend_combined ->
inv_inc_big_overview in the right order, with the tree lists
handed on where they are needed, so that callers do not have to reproduce it.
Usage
inv_increment_repeated_survey(
inv_1st,
inv_2nd,
inv_1st_trees,
inv_2nd_trees,
method = c("rep_classic", "rep_mean", "rep_end", "rep_trans"),
fill_option = c("standard", "min_estimates", "all_estimates"),
match_type = c("plot_id", "center_coord"),
plot_id_style = c("baysf", "generic"),
tree_id_style = c("baysf", "generic"),
inner_circle_non_matchable = FALSE,
shrinkage_rate_per_decade = 0.1,
species_check = c("species_group", "species", "warn_only"),
clamp_plausible_shrinkage = TRUE,
coord_tolerance = 10,
include_reptrees = TRUE,
include_second_only = TRUE,
d_q_interval = 10,
dt_second_only = -5,
style = c("baysf", "generic"),
progress_bar = TRUE,
keep_steps = FALSE
)
Arguments
inv_1st, inv_2nd |
The two |
inv_1st_trees, inv_2nd_trees |
The matching tree data frames, as pulled
from the two inventories and prepared with the canonical chain
|
method |
The repeated-survey increment method, one of
|
fill_option |
How the gnfi3 gap-filling estimates are used, one of
|
match_type, plot_id_style, tree_id_style, coord_tolerance |
Plot- and
tree-matching arguments, passed to
|
inner_circle_non_matchable, shrinkage_rate_per_decade, species_check, clamp_plausible_shrinkage |
Further arguments of |
include_reptrees |
Passed to |
include_second_only |
Logical, whether plots that exist only in the
second survey are folded in. Default |
d_q_interval |
Numeric, width (cm) of the quadratic mean diameter
classes. Passed to |
dt_second_only |
Time span (years, negative = backward) of the gnfi3
estimate for the second-only plots. Default |
style |
Species grouping style of the enterprise-level overview,
|
progress_bar |
Logical, whether the function displays a console progress
bar itself. Default |
keep_steps |
Logical. If |
Details
The individual step functions stay exported and are the expert-level interface: use them when a single stage has to be inspected, varied or replaced. For everything else this function is the intended route, and it is the one whose result is guaranteed to be internally consistent.
Value
An object of class fe_increment_repsurv (which inherits from
fe_increment), a list with
- trees
The per-tree increment data frame covering the whole enterprise, carrying the
"inc_meta"attribute. This is the input forincrement_base_tableandincrement_base_table_main_stand.- overview
The enterprise-level aggregate, output of
inv_inc_big_overview, input foroutput_increment_overall.- summaric
The summaric (ertragsgeschichtlicher) increment, output of
inv_inc_summaric– the gold standard at enterprise level.- meta
The header meta (survey years, period, area, point count, calculation method, fill option).
- steps
The intermediate results of the chain (
tree_level,filled,consolidated,extended_matched) for inspection, orNULL– seekeep_steps.
Which inventories are admissible
This is a sample inventory method and applies only to sample
inventories in concentric circles (Stichprobeninventur, taxonomy axis
sample x concentric). Both fe_inventory objects must
consist entirely of
fe_ccircle_spatial plots (its _notrees
child included) – the tree matching relies on the plot geometry and the tree
positions those objects carry. Stand-wise inventories (standwise x
relascope, plain fe_stand plots) carry no tree positions and
therefore have no repeated-survey increment; they are rejected with an error
by inv_increment_repsurv_ccirc_check_input, which runs first.
The two surveys must further be a genuine pair: the same enterprise, the
first one earlier than the second, at least one year apart.
Whole-enterprise coverage
The per-tree result covers the whole enterprise, not just the plots measured
twice. Plots that exist only in the second survey (new establishments, sample
extensions) cannot have a repeated-survey increment by construction, so they
receive a backward gnfi3 estimate via
inv_inc_tree_extend_combined. This matters for more than
completeness: the increment base tables express their per-hectare increment
over the full operation area, so leaving these plots out would put
their area into the denominator while their increment is missing from the
numerator, and every per-hectare figure would come out too low. With them
folded in, the base tables reproduce the enterprise level
(inv_inc_big_overview's combined rows) exactly. Set
include_second_only = FALSE only to reproduce the matched-plots-only
view, and be aware of the bias just described.
Progress reporting
The chain reports its seven phases through the progressr framework.
With the default progress_bar = TRUE the function displays a console
bar itself, so an interactive user needs no ceremony. With
progress_bar = FALSE it only signals progress and the caller
decides what to do with it – notably a Shiny app, which wraps the call in
progressr::withProgressShiny() and gets its own progress bar without
FeNEU knowing anything about Shiny. Always pass progress_bar = FALSE
when supplying a handler yourself, otherwise two handlers compete. The phase
labels are translated (options(fe_lang = "de")).
The progress bars of the inner steps are switched off deliberately
(inv_increment_repsurv_ccirc is called with
progress_bar = FALSE): the tree matching would otherwise draw its own
per-plot bar over the phase bar of this function. Progress is reported at
this level only.
See Also
increment_base_table,
increment_base_table_main_stand,
output_increment_overall,
output_increment_base_table_pdf
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
# The prepared tree lists ship with the package; how they were built with
# the canonical chain is shown in ?data_ex3_trees_essentials
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# The whole chain in one call
suppressWarnings(suppressMessages({
inc <- inv_increment_repeated_survey(
inv_a, inv_b, inv_a_trees, inv_b_trees,
method = "rep_classic", fill_option = "standard",
progress_bar = FALSE
)
}))
# Enterprise level, and the base tables built on the same object
inc$overview$combined$overall$iv_total
increment_base_table(inc, by_class = "age")$all_total
Calculate Tree-Wise Increments From Two Subsequent Inventories Based on Concentric Circle Plots With Spatial Information
Description
Main function to be used when calculating tree-level increments based on
repeated inventories with concentric circle sample plots
(fe_ccircle_spatial).
Usage
inv_increment_repsurv_ccirc(
inv_1st,
inv_2nd,
inv_1st_trees,
inv_2nd_trees,
match_type = c("plot_id", "center_coord"),
plot_id_style = c("baysf", "generic"),
tree_id_style = c("baysf", "generic"),
method = c("rep_classic", "rep_mean", "rep_end", "rep_trans"),
inner_circle_non_matchable = FALSE,
shrinkage_rate_per_decade = 0.1,
species_check = c("species_group", "species", "warn_only"),
clamp_plausible_shrinkage = TRUE,
coord_tolerance = 10,
progress_bar = TRUE
)
Arguments
inv_1st |
|
inv_2nd |
|
inv_1st_trees |
A data frame resulting from applying the functions
|
inv_2nd_trees |
A data frame resulting from applying the functions
|
match_type |
Character string indicating the method for matching
inventory plots from the two subsequent inventories. The option
"center_coord" matches points whose center coordinates have a distance of
no more than |
plot_id_style |
Character string indicating the plot_id style to be
used. Only relevant when |
tree_id_style |
Character string that indicates how trees are uniquely identified on inventory plot level. This is required for matching trees on the same plot in both inventories. The options are "baysf" (default) and "generic". In the BaySF case, trees are matched by their polar coordinates, while in the generic case, the tree_ids must mark the same trees in both inventories. |
method |
Character string, choices are |
inner_circle_non_matchable |
Logical, default |
shrinkage_rate_per_decade |
Numeric, the maximum plausible volume
shrinkage rate per decade for re-measured trees. Trees exceeding this
threshold are flagged as implausible. Uses an exponential decay model
internally, scaled to the actual survey interval. Default is |
species_check |
Character string controlling how species consistency
is checked for re-measured trees. Options are |
clamp_plausible_shrinkage |
Logical. If |
coord_tolerance |
Maximum distance allowed for a match of two inventory
plots in the distance unit of the coordinate reference system of
|
progress_bar |
Boolean, if |
Details
Even though the volume increments are calculated on tree level here, they are
upscaled to 1 ha. This is important, because otherwise the increment
represented by trees that change their representation number per ha between
both inventories cannot be calculated correctly. Trees present in the first
survey only always get zero increment; such values can be replaced by
model-based estimates in a subsequent step. The function allows to choose
between four methods of increment calculation (parameter method):
-
rep_classic: The volume increment,iv, of trees that are present in both inventories is calculated asiv=n[2]\cdot v[2]-n[1] \cdot v[1], withnandvbeing the representation number per hectare and the volume of the tree at the first and the second survey, respectively. The volume increment of the ingrowth trees isiv=n[2]*v[2], i.e. such trees contribute to the increment with their full volume. This method is equivalent to the classic stand level increment calculation (German "Ertragsgeschichtlicher Zuwachs"), however, some trees (and plots) may also have negative increments. This might look strange, but is fully valid from a statistical angle of view. -
rep_mean: The volume increment,iv, of trees that are present in both inventories is calculated asiv=(n[2]+n[1])/2\cdot (v[2]-v[1]), and the volume increment of ingrowth trees is calculated asiv=n[2]*(v[2]-v_t), wherev_tis the tree's volume when it crossed the sampling threshold. This method is not compatible to the classic stand level increment calculation. Guaranteesiv>=0whenclamp_plausible_shrinkage = TRUE. -
rep_end: The volume increment,iv, of trees that are present in both inventories is calculated asiv=n[2]\cdot (v[2]-v[1]), and the volume increment of ingrowth trees is calculated asiv=n[2]*(v[2]-v_t), wherev_tis the tree's volume when it crossed the sampling threshold. This method is not compatible to the classic stand level increment calculation. Guaranteesiv>=0whenclamp_plausible_shrinkage = TRUE. -
rep_trans: The volume increment,iv, of trees that are present in both inventories, and did not cross a sampling threshold, is calculated asiv=n\cdot (v[2]-v[1]), withn=n[1]=n[2]. For trees that crossed a sampling threshold, the calculation isiv=n[2]\cdot (v[2]-v_t) + n[1]\cdot (v_t-v[1]). The volume increment of ingrowth trees is calculated asiv=n[2]*(v[2]-v_t), wherev_tis the tree's volume when it crossed the sampling threshold. This method is not compatible to the classic stand level increment calculation and always guaranteesiv>=0(negative volume differences are clamped to zero regardless ofclamp_plausible_shrinkage).
Value
A list with six elements: i) tree_increments is a data frame
that identifies all trees that were appropriate for increment calculation
with their plot and tree id in both inventories, and contains their annual
and periodic volume increment (in m³/ha under bark after harvest). Note
that in case of decreasing representation numbers between both surveys,
increments can be also become negative which is statistically correct. ii)
plot_matches informs about the outcome of the required plot matching
across both inventories. It is the output of
match_2_inventories which is called internally. iii)
match_plot_stats which gives an overview of the plot matching
results in terms of plot numbers and representation areas (i.e. the output
of an internal call to match_plot_statistics). iv)
match_tree_stats provides similar overview statistics on tree level.
v) inv_period is the output of inv_period, computed
once here so downstream functions can access the survey years and the
inter-survey period without having to carry the fe_inventory
objects further. vi) method is the increment method that was
used in this call (one of "rep_classic", "rep_mean",
"rep_end", "rep_trans"); carried through so downstream
consumers can label outputs accordingly.
Position in the workflow
This is the first of six steps that lead from a pair of inventories to
the increment tables and their PDFs. Unless a single stage has to be inspected
or varied, call inv_increment_repeated_survey instead: it runs
the whole chain in one call, hands the tree lists on where they are needed,
and – importantly – includes the plots that exist only in the second survey,
which a hand-built chain easily forgets (see the coverage warning in
inv_inc_tree_extend).
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other repeated inventory:
harmonize_inv_for_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
reclassify_pseudo_ingrowth_ccirc()
Examples
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# The two match types. "center_coord" pairs plots by their centres within
# a tolerance, "plot_id" by their identifiers.
inv_increment_repsurv_ccirc(
inv_a, inv_b, inv_a_trees, inv_b_trees,
match_type = "center_coord", coord_tolerance = 10,
method = "rep_classic"
)
# The four methods differ only in how the increment of a single tree is
# formed; "rep_classic" above and "rep_trans" here are the two that matter
# in practice, "rep_mean" and "rep_end" are set the same way. See the
# increment vignette for the formulae.
inv_increment_repsurv_ccirc(
inv_a, inv_b, inv_a_trees, inv_b_trees,
match_type = "plot_id", plot_id_style = "baysf",
method = "rep_trans"
)
Check Input Provided for inv_increment_repsurv_ccirc
Description
Two sample plot based inventories that are considered repeated inventories of the same forest area are checked for important preconditions for matching them plotwise in a subsequent step (appropriate classes, consistency with regard to inventory times). If the check is successful, this does not guarantee succesful matching later, but if it is not, matching makes no sense at all. The function belongs in the context of calculating increment from repated sample inventories.
Usage
inv_increment_repsurv_ccirc_check_input(inv_1st, inv_2nd)
Arguments
inv_1st |
|
inv_2nd |
|
Details
The function is typically called from within
inv_increment_repsurv_ccirc. Note that the check only covers
the two fe_inventory objects handed to
inv_increment_repsurv_ccirc. It does not check the two
corresponding data frames that are also expected as an input to
inv_increment_repsurv_ccirc for reasons of computation
efficiency. However, as long as the user makes sure that these data frames
are generated from the fe_inventory objects, checking the
latter is sufficient.
Value
A two-element vector containing the year of the first and the second inventory if all checks are successful, i.e. both inventories fulfill all preconditions for meaningfully matching them. Otherwise, the function terminates with an error.
Estimate the Volume Increment of a Single Inventory With Yield Tables
Description
Covers the whole chain from a prepared tree list to a ready-to-aggregate
increment result. It is the yield-table counterpart of
inv_increment_repeated_survey and
inv_increment_gnfi3: all three return an object of class
fe_increment, carry their report header in meta, and are
consumed the same way.
Usage
inv_increment_ytables(
inv,
inv_trees,
ytable_selection,
plot_area_weight = TRUE
)
Arguments
inv |
An |
inv_trees |
Tree data frame as pulled from |
ytable_selection |
A data frame that assigns names of existing
|
plot_area_weight |
Logical, if TRUE (default), the single plots are weighted with the area they represent. If FALSE all plots are equally weighted. |
Details
The symmetry stops where the method does. A yield-table increment is not estimated per tree but for a cohort: one species in the main stand of one inventory plot, on the ideal (virtual monospecific) area it occupies there. The estimate needs the cohort's age and its mean height, which give the site index; age and site index give the per-hectare increment of the yield table, which is then corrected by the stocking level (the cohort's basal area over the basal area the table expects). Consequently this bundle holds no per-tree increments, the method is confined to the main stand, and the class tables cannot be filtered to arbitrary collectives the way the per-tree strands can.
A cohort has one age and one quadratic mean diameter, so the class an
evaluation is grouped by – age class or diameter class – is a label
on the result, not part of the estimate. Both labels are carried, and
increment_ytables_base_table groups by whichever is asked for
without estimating anything again.
Value
An object of class fe_increment_ytables, which inherits from
fe_increment. A list with the elements
- cohorts
one row per inventory plot and species: age, quadratic mean diameter and height, ideal area, site index, stocking level and the annual increment. This is the estimate itself,
- overview
the species-group overview of the whole inventory,
- meta
the figures the reports print in their header,
- ytables_used
the yield tables actually used, per species group,
- collective
the collective descriptor, always the main stand.
See Also
increment_ytables_base_table for the class tables,
output_increment_overview_ytables_pdf for the overview
report, inv_increment_gnfi3 for the per-tree single-inventory
counterpart.
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
inc <- inv_increment_ytables(
inv = data_ex3_sample_fe_inventory,
inv_trees = data_ex3_sample_trees_essentials,
ytable_selection = ytables_bavrn_state_var_1_feneu
)
inc
inc$overview
Survey Years and Period Between Two Inventories
Description
Convenience helper that extracts the survey years of two
fe_inventory objects and returns them together with the
resulting inter-survey period, after the same validation that
inv_increment_repsurv_ccirc applies. Used by functions that
combine two inventories so that downstream consumers (e.g.
inv_inc_summaric) can access the period without having to
carry the fe_inventory objects further.
Usage
inv_period(inv_1st, inv_2nd)
Arguments
inv_1st, inv_2nd |
Two |
Value
A list with elements time_yr_1st, time_yr_2nd,
and period_yr (the difference).
Examples
inv_period(
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory
)
Cross-check plot IDs between tree list and inventory-point list
Description
Compares the set of plot IDs (plot_id) present in the tree list
against those in the inventory-point list. If the two sets differ, the
function emits a diagnostic message() and writes two tab-delimited
diagnostic files into output_dir:
-
tree_not_in_inv.txt— plots with trees but no inventory point -
inv_not_in_tree.txt— inventory points with no trees
Writing the diagnostic files alongside the check is intentional: it gives the user ready-to-inspect artefacts without requiring the orchestrating function to manage intermediate data frames.
Usage
inv_point_checks(tree_list, Iventurpunkte, output_dir)
Arguments
tree_list |
Data frame containing the tree list; must have a
|
Iventurpunkte |
Data frame containing the inventory-point list; must
have a |
output_dir |
Path of the output folder (character). Diagnostic files are written here when the two ID sets do not match; created if it does not exist. |
Details
They go to the output folder, not next to the input data: the output folder is the one the user picked to be written to, so write permission there is assured (and their business), whereas the input folder may be read-only.
Value
Invisibly, a named list with the mismatch counts
n_tree_not_in_inv (plots with trees but no inventory point) and
n_inv_not_in_tree (inventory points with no trees); both 0
when the two ID sets match. The orchestrator uses n_tree_not_in_inv
to raise a report warning, because trees on those plots have no plot record
and are dropped further down the build.
Inventory-Wide Meta Information for the Table Headers
Description
Derive the enterprise-level figures that the meta block of the static table
PDFs (output_base_table_pdf,
output_structure_table_pdf) displays: the inventory year, the
total (represented) area, and the number of inventory points. The result is
returned in exactly the list(year, area_ha, n_plots) shape those
functions expect for their meta argument (and their inventory
argument uses this function internally).
Usage
inventory_meta(x)
Arguments
x |
A |
Details
The figures are read off the whole fe_inventory object, which
is the authoritative plot list - so treeless plots (and their area) are
counted too, unlike a derivation from an already-filtered tree table. This
mirrors how the increment tables derive their header meta from the second
inventory.
Value
A named list with three elements: year (the survey year; the
most recent one if the plots carry more than one, with a warning),
area_ha (sum of the per-plot represented areas), and n_plots
(number of inventory points).
Examples
inventory_meta(data_ex3_sample_fe_inventory)
Test for the Class fe_increment_gnfi3
Description
Test for the Class fe_increment_gnfi3
Usage
is_fe_increment_gnfi3(x)
Arguments
x |
An object |
Value
TRUE if x is an fe_increment_gnfi3 object,
FALSE otherwise
Examples
inc <- inv_increment_gnfi3(
data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials
)
is_fe_increment_gnfi3(inc)
Is an Object an fe_increment_repsurv?
Description
Is an Object an fe_increment_repsurv?
Usage
is_fe_increment_repsurv(x)
Arguments
x |
Object to test. |
Value
Logical.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
is_fe_increment_repsurv(1L)
Test for the Class fe_increment_ytables
Description
Test for the Class fe_increment_ytables
Usage
is_fe_increment_ytables(x)
Arguments
x |
An object |
Value
TRUE if x is an fe_increment_ytables object,
FALSE otherwise
Examples
inc <- inv_increment_ytables(
data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials,
ytables_bavrn_state_var_1_feneu
)
is_fe_increment_ytables(inc)
Check if an Object is an fe_inventory
Description
Check if an Object is an fe_inventory
Usage
is_fe_inventory(x)
Arguments
x |
an object |
Value
TRUE if the object inherits from the fe_stand class
Examples
is_fe_inventory(data_ex4_sample_fe_inventory)
Match two fe_inventory Objects on Plot Level
Description
Wraps the functions match_2_inventories_by_center_coord, and
match_2_inventories_by_plot_id and decides which one to call.
Usage
match_2_inventories(
inv_a,
inv_b,
match_type = c("plot_id", "center_coord"),
plot_id_style = c("baysf", "generic"),
coord_tolerance = 10
)
Arguments
inv_a |
An object of class |
inv_b |
An object of class |
match_type |
Character string indicating the method for matching
inventory plots from the two subsequent inventories. The option
"center_coord" matches points whose center coordinates have a distance of
no more than |
plot_id_style |
Character string indicating the plot_id style to be
used. Only relevant when |
coord_tolerance |
Maximum distance allowed for a match of two inventory
plots in the distance unit of the coordinate reference system of
|
Value
A list with five elements: i) matches – the matching
inventory plots, ii) in_a_only – plots that exist in inv_a
only, iii) in_b_only – plots that exist in inv_b only,
iv) multiple_matches – a logical vector identifying multiple
matches (can only occur with match_type = "center_coord" and is
undesired), and v) circle_def_mismatch – plot pairs that matched
by id or coordinates but were excluded because their circle definitions
(dbh_lower and/or c_area) differ between the two inventories.
Such pairs are unsuitable for tree-level increment calculations from
repeated surveys. The exact types of the objects (tibbles or sf) in this
list depend on the match_type the function has been called with,
but they always contain a column with the relevant plot ids.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other repeated inventory:
harmonize_inv_for_repsurv(),
inv_increment_repsurv_ccirc(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
reclassify_pseudo_ingrowth_ccirc()
Other inventory matches:
harmonize_inv_for_repsurv(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc()
Examples
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
# both options for match_type work for this example
match_2_inventories(inv_a, inv_b, match_type = "plot_id", "baysf")
match_2_inventories(inv_a, inv_b, match_type = "center_coord", "baysf")
Match Two fe_inventory Objects by the Center Coordinates of the Inventory Plots
Description
From two fe_inventory objects identify the matching and non-
matching inventory plots based on their center coordinates. A warning is
issued if the matching coordinates indicate spatial one-to-many or
many-to-many relationships.
Usage
match_2_inventories_by_center_coord(inv_a, inv_b, tolerance = 0)
Arguments
inv_a |
An object of class |
inv_b |
An object of class |
tolerance |
Maximum distance allowed for a match of two inventory plots
in the distance unit of the coordinate reference system of |
Value
A list containing three sf objects, matches,
in_a_only, and in_b_only, and one logical vector
multiple_matches. The three sf objects indicate the
inventory plots that are present in both, inv_a and inv_b,
only in inv_a but not in inv_b, and only in inv_b but
not in inv_a, respectively. The sf object matches has
the columns plot_id.inv_a, plot_id.inv_b, and geometry
(i.e. the point coordinates). Thereby, The column plot_id_inv_a
contains the id of a plot it has in inv_a, and analogously with
plot_id_inv_b. Note that spatially matching points do not
necessarily need to have the same plot_id in both inventories. The
sf object in_a_only has only two columns, plot_id, and
geometry. The same applies to the sf object in_b_only.
the plot_id entries for the other inventories are NA. The vector
multiple_matches relates to the matches object, and
indicates entries with the same center coordinates. This indicates
one-to-many or many-to-many relations between the two input inventories
which is usually a problem. Therefore, multiple_matches should
only contain FALSE entries.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other repeated inventory:
harmonize_inv_for_repsurv(),
inv_increment_repsurv_ccirc(),
match_2_inventories(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
reclassify_pseudo_ingrowth_ccirc()
Other inventory matches:
harmonize_inv_for_repsurv(),
match_2_inventories(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc()
Examples
# Construct a dummy example with partly non-matching plots from one
# fe_inventory object
inv_a <- data_ex3_sample_fe_inventory[3:10, ]
inv_b <- data_ex3_sample_fe_inventory[1:7, ]
# As both dummy inventories were generated from the same set, we do not
# require any tolerance > 0
match_2_inventories_by_center_coord(inv_a, inv_b, tolerance = 0)
# Now a real example from two subsequent inventories
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
# Requires a tolerance of 10.0 m in order to obtain the correct match
# (as indicated by the plot ids)
match_2_inventories_by_center_coord(inv_a, inv_b, tolerance = 10.0)
# If tolerance is set too high (here unrealistic 3000 m for demo purposes),
# we obtain duplicate matches and a warning message
match_2_inventories_by_center_coord(inv_a, inv_b, tolerance = 3000)
Match Two fe_inventory Objects by the IDs of the Inventory Plots
Description
From two fe_inventory objects identify the matching and non-
matching inventory plots based on their center coordinates.
Usage
match_2_inventories_by_plot_id(inv_a, inv_b, style = c("generic", "baysf"))
Arguments
inv_a |
An object of class |
inv_b |
An object of class |
style |
Character, two options "generic" and "baysf". The former
requires that the column |
Value
A list that comprises three data frames (tibbles): The first one,
matches, has two columns, plot_id_inv_a, and
plot_id_inv_b which indicate the ids of the matching plot_ids
in both inventories. The two columns are required because there may be
situations (BaySF style) where the ids of matching points are not entirely
the same. The second data frame, in_a_only, contains the ids of
those plots that exist in inv_a, but not in inv_b, while the
third one, in_b_only, contains the ids of the plots that are present
in inv_b, but not in inv_a.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other repeated inventory:
harmonize_inv_for_repsurv(),
inv_increment_repsurv_ccirc(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
reclassify_pseudo_ingrowth_ccirc()
Other inventory matches:
harmonize_inv_for_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc()
Examples
# Construct a dummy example with partly non-matching plots from one
# fe_inventory object
inv_a <- data_ex3_sample_fe_inventory[3:10, ]
inv_b <- data_ex3_sample_fe_inventory[1:7, ]
# These are BaySF style inventory data, which means that even matching plot
# ids from subsequent inventories are equal only with regard to their last
# group of digits. However, as this example was constructed from only one
# inventory, both style options, "baysf" and "generic" are equally ok.
match_2_inventories_by_plot_id(inv_a, inv_b, style = "baysf")
match_2_inventories_by_plot_id(inv_a, inv_b, style = "generic")
# Now a real example with two subsequent inventories
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
# These are BaySF style inventory data, from real subsequent inventories.
# Therefore, we must choose that style for matching
match_2_inventories_by_plot_id(inv_a, inv_b, style = "baysf")
# The generic inventory style requires that corresponding plots have the
# same plot_id in both inventories. We can achieve that with a slight
# manipulations of the BaySF style data used above (i.e. reducing the
# original plot_ids to the last group of digits):
inv_a <- inv_a |>
dplyr::mutate(
plot_id = purrr::map_chr(
plot_id, .f = function(.x) strsplit(.x, "_")[[1]][3]
)
)
inv_b <- inv_b |>
dplyr::mutate(
plot_id = purrr::map_chr(
plot_id, .f = function(.x) strsplit(.x, "_")[[1]][3]
)
)
# Now we achieve the same result as above with generic-style matching
match_2_inventories_by_plot_id(inv_a, inv_b, style = "generic")
Generate Plot Match Overview Statistics from the Output of
match_2_inventories
Description
Informs about the numbers of plots that match and do not match in both inventories, and the corresponding representation areas in ha.
Usage
match_plot_statistics(plot_matches, inv_a, inv_b)
Arguments
plot_matches |
list, output of |
inv_a |
An object of class |
inv_b |
An object of class |
Value
A list containing two named vectors, plot_numbers, and
rep_areas_ha. These contain the statistics relating to plot numbers
and represented areas, respectively. Both include a count/area for
plots excluded due to incompatible circle definitions
(n_circle_def_mismatch, ha_circle_def_mismatch_1st,
ha_circle_def_mismatch_2nd).
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other repeated inventory:
harmonize_inv_for_repsurv(),
inv_increment_repsurv_ccirc(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
reclassify_pseudo_ingrowth_ccirc()
Other inventory matches:
harmonize_inv_for_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc()
Examples
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
# both options for match_type work for this example
match_pid <- match_2_inventories(
inv_a, inv_b, match_type = "plot_id", "baysf"
)
match_crd <- match_2_inventories(
inv_a, inv_b, match_type = "center_coord", "baysf"
)
# stats should be the same in both cases
match_plot_statistics(match_pid, inv_a, inv_b)
match_plot_statistics(match_crd, inv_a, inv_b)
Provide an Overview of the Tree Matching Results on Inventory Level
Description
Typically called from within inv_increment_repsurv_ccirc.
The returned vector summarises the matching outcome from the perspective
of both inventories and breaks the matched-trees population into the
status categories that the rest of the pipeline distinguishes — so users
can see at a glance how many trees were unambiguously re-measured, how
many were verified ingrowth / disappearances, how many fall into the
unmatchable inner-circle cohort, and how many were reclassified as
pseudo-ingrowth by reclassify_pseudo_ingrowth_ccirc.
Usage
match_tree_statistics(tree_matches, inv_1st_trees, inv_2nd_trees)
Arguments
tree_matches |
Data frame, output of
|
inv_1st_trees |
A data frame resulting from applying the functions
|
inv_2nd_trees |
A data frame resulting from applying the functions
|
Value
A named numeric vector with the following entries:
- n_total_1st
Total number of trees in
inv_1st_trees.- n_in_match_1st
Trees of the 1st survey that appear in
tree_matches(i.e. their plot is part of the matched plot set).- n_in_both_1st
Trees of the 1st survey that were unambiguously re-measured: rows with
tree_exists_1standtree_exists_2ndbothTRUEthat carry an identified inv-1 record (tree_id_1stnotNA).- n_total_2nd
Total number of trees in
inv_2nd_trees.- n_in_match_2nd
Trees of the 2nd survey that appear in
tree_matches. Counted from the inv-2 side and therefore not the same population asn_in_match_1st: 1st-only rows are absent here and 2nd-only rows are absent there, so the two numbers routinely differ.- n_in_both_2nd
The inv-2 side of the re-measured trees. This is not a mirror of
n_in_both_1stand the two are expected to differ as soon as pseudo-ingrowth occurs:reclassify_pseudo_ingrowth_ccircsetstree_exists_1st = TRUEon 2nd-only rows to record that the tree did exist at inv 1, but it leavestree_id_1statNA, because no individual inv-1 record was identified (that is precisely why the tree was unmatchable). Such rows therefore count towardsn_in_both_2ndbut cannot count towardsn_in_both_1st, andn_in_both_2nd - n_in_both_1st = n_pseudo_ingrowthholds by construction. A difference of exactly that size is correct behaviour, not a matching defect.- n_unmatchable_1st
Inv-1 trees that carry a measured value but could not be matched to inv 2 because their matching key was unreliable (typically inner-circle trees recorded without polar coordinates). They show up in
tree_matchesas 1st-only rows withtree_exists_2nd = NAandis_unmatchable_1st = TRUE.- n_unmatchable_2nd
Inv-2 counterpart: 2nd-only rows with
tree_exists_1st = NAandis_unmatchable_2nd = TRUE. Trees reclassified byreclassify_pseudo_ingrowth_ccircalso carry theis_unmatchable_2ndflag and are included in this count.- n_verified_ingrowth
2nd-only rows that the inv 2 match pool saw and verified to have no inv 1 partner (genuine new trees above the smallest sampling threshold).
- n_verified_removal
1st-only rows with verified absence at inv 2 (
tree_exists_2nd %in% FALSE, i.e. matchable inv 1 record but no inv 2 partner found).- n_pseudo_ingrowth
Number of 2nd-only inv 2 records that
reclassify_pseudo_ingrowth_ccircreclassified as pseudo-ingrowth (inner-circle inv 1 origin reconstructed via gnfi3 backward). 0 when the reclassification step is absent or did not fire.
Match Trees on Subsequent Inventories on Inventory Level
Description
Typically called from within inv_increment_repsurv_ccirc. The
consistency of the input to this function is not checked here. In essence,
the function wraps serial calls of
match_trees_on_plot_repsurv_ccirc.
Usage
match_trees_on_inventory_repsurv_ccirc(
inv_point_matches,
inv_1st,
inv_2nd,
inv_1st_trees,
inv_2nd_trees,
tree_id_style = c("baysf", "generic"),
inner_circle_non_matchable = FALSE,
shrinkage_rate_per_decade = 0.1,
species_check = c("species_group", "species", "warn_only"),
progress_bar = TRUE
)
Arguments
inv_point_matches |
Output of |
inv_1st |
|
inv_2nd |
|
inv_1st_trees |
A data frame resulting from applying the functions
|
inv_2nd_trees |
A data frame resulting from applying the functions
|
tree_id_style |
Character string that indicates how trees are uniquely identified on inventory plot level. This is required for matching trees on the same plot in both inventories. The options are "baysf" (default) and "generic". In the BaySF case, trees are matched by their polar coordinates, while in the generic case, the tree_ids must mark the same trees in both inventories. |
inner_circle_non_matchable |
Logical, default |
shrinkage_rate_per_decade |
Numeric, the maximum plausible volume
shrinkage rate per decade. Default is |
species_check |
Character string controlling species consistency
checks. Options: |
progress_bar |
Boolean, if |
Value
A data frame identifying all matching trees with their tree and
plot ids in both inventories, the calendar years of both inventories,
and columns with flags that indicate in which of both inventories
a tree exists (can be only one of them or both). Additionally contains
the columns volume_change_rate_per_decade (the observed volume
change rate scaled to a decade, based on an exponential model; positive
values indicate growth, negative values indicate shrinkage),
volume_change_implausible (logical, TRUE if shrinkage
exceeds the threshold), and species_mismatch (logical,
TRUE if species identity changed between surveys according to
the species_check setting).
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other repeated inventory:
harmonize_inv_for_repsurv(),
inv_increment_repsurv_ccirc(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_plot_repsurv_ccirc(),
reclassify_pseudo_ingrowth_ccirc()
Other inventory matches:
harmonize_inv_for_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_plot_repsurv_ccirc()
Examples
# Prepare everything required
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
# Match inventory points
inv_pt_mtch <- match_2_inventories(inv_a, inv_b, "plot_id", "baysf")
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# Finally, make the match
match_trees_on_inventory_repsurv_ccirc(
inv_pt_mtch, inv_a, inv_b, inv_a_trees, inv_b_trees,
tree_id_style = "baysf"
)
Match Trees on Subsequent Inventories of One Plot
Description
Identifying trees that do or do not occur in two subsequent observations of
one inventory plot of class
fe_ccircle_spatial. Takes into account only
trees with an entry in the tree_positions slot of the
fe_ccircle_spatial object. Trees that have
a removal flag in the first observation are excluded, because they are not
relevant for increment calculations.
Usage
match_trees_on_plot_repsurv_ccirc(
plot_in_inv_1st,
plot_in_inv_2nd,
tree_id_style = c("baysf", "generic"),
inner_circle_non_matchable = FALSE
)
Arguments
plot_in_inv_1st |
An inventory plot represented as an object of class
|
plot_in_inv_2nd |
An inventory plot representing a later survey of plot
|
tree_id_style |
Character string that indicates how trees are uniquely identified on inventory plot level. This is required for matching trees on the same plot in both inventories. The options are "baysf" (default) and "generic". In the BaySF case, trees are matched by their polar coordinates, while in the generic case, the tree_ids must mark the same trees in both inventories. |
inner_circle_non_matchable |
Logical, default |
Details
Typically called from within
match_trees_on_inventory_repsurv_ccirc which in turn is called
by inv_increment_repsurv_ccirc.
The function does not check whether the two input inventory plots
(plot_in_inv_1st, plot_in_inv_2nd) are really matching, i.e.
represent two subsequent surveys of the same plot. This must be made sure
before calling it.
Value
A data frame with seven columns, tree_id_1st,
tree_id_2nd, tree_exists_1st, tree_exists_2nd,
time_yr_1st, and time_yr_2nd. The first two contain the ids
of the plot and the matching trees in the first inventory. If a tree is not
present in one inventory, its id value is NA. Similarly, the third
and the fourth column have the value TRUE or FALSE if a tree
exists in an inventory or not. The column tree_removal_2nd indicates
whether a tree has been registed as removed (TRUE) or not
(FALSE) in the second inventory.
The tree_id and the tree_exists columns are somewhat redundant, but their
different formats may be useful in subsequent evaluations. The sixth and
the seventh column contain the years of both inventories. These two columns
do never have NA values.
Trees sharing one position
With tree_id_style == "baysf" trees are matched on their exact
polar coordinates. If two trees of the same plot and survey carry the
same distance and azimuth, that position identifies neither of them, and
an exact-coordinate join would pair every inv-1 tree at the spot with
every inv-2 tree at the spot — a Cartesian product that lets a tree enter
the increment more than once.
The rule is therefore: a position shared by more than one tree of
the same plot and survey is treated as no position at all. The affected
trees are handled exactly like trees recorded without coordinates — they
are excluded from the match and flagged is_unmatchable_1st resp.
is_unmatchable_2nd. Their measured volumes still reach the
standing-volume aggregates, they simply contribute no individual
increment, and they never become pseudo-ingrowth candidates (their
tree_exists_* stays NA). Each occurrence raises a warning
naming the plot and the trees.
Duplicated coordinates are a defect of the source data, not a modelling choice, and they are rare (single-digit counts per real inventory). This rule keeps the increment computation well-defined and conservative rather than resolving the ambiguity by guessing which tree is which.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other repeated inventory:
harmonize_inv_for_repsurv(),
inv_increment_repsurv_ccirc(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
reclassify_pseudo_ingrowth_ccirc()
Other inventory matches:
harmonize_inv_for_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc()
Examples
# Standard case: Match two single plots, both with the same set of trees
## Select two matching plots from two subsequent inventories
plot_1st <- data_ex3_previous_sample_fe_inventory |>
dplyr::filter(plot_id == "900100002_1_99900002") |>
purrr::pluck("plot", 1)
plot_2nd <- data_ex3_sample_fe_inventory |>
dplyr::filter(plot_id == "900000002_1_99900002") |>
purrr::pluck("plot", 1)
## Here's the actual matching
match_trees_on_plot_repsurv_ccirc(
plot_1st, plot_2nd, tree_id_style = "baysf"
)
# Standard case: Match two single plots, some trees however missing in
# the first or the second inventory
## Construct the data from the example above by clipping out trees from
## plot_1st
plot_2nd <- plot_1st
miss_index <- c(1, 2, 4, 5)
plot_1st$trees <- plot_1st$trees |>
dplyr::arrange(tree_id) |>
dplyr::slice(- miss_index)
plot_1st$tree_positions <- plot_1st$tree_positions |>
dplyr::arrange(tree_id) |>
dplyr::slice(- miss_index)
miss_index <- c(3, 7, 8)
plot_2nd$trees <- plot_2nd$trees |>
dplyr::arrange(tree_id) |>
dplyr::slice(- miss_index)
plot_2nd$tree_positions <- plot_2nd$tree_positions |>
dplyr::arrange(tree_id) |>
dplyr::slice(- miss_index)
## Matching works with both styles in this example
match_trees_on_plot_repsurv_ccirc(
plot_1st, plot_2nd, tree_id_style = "baysf"
)
match_trees_on_plot_repsurv_ccirc(
plot_1st, plot_2nd, tree_id_style = "generic"
)
# Special case: First survey has no trees (all ingrowth)
## Construct an artifical example
plot_1st <- ForestElementsR::spruce_pine_ccircle_spatial_notrees
plot_2nd <- ForestElementsR::spruce_pine_ccircle_spatial
## Matching works with both styles in this example
match_trees_on_plot_repsurv_ccirc(
plot_1st, plot_2nd, tree_id_style = "baysf"
)
match_trees_on_plot_repsurv_ccirc(
plot_1st, plot_2nd, tree_id_style = "generic"
)
# Special case: Second survey has no trees (all felled)
## Construct an artifical example
plot_1st <- ForestElementsR::spruce_pine_ccircle_spatial
plot_2nd <- ForestElementsR::spruce_pine_ccircle_spatial_notrees
## Matching works with both styles in this example
match_trees_on_plot_repsurv_ccirc(
plot_1st, plot_2nd, tree_id_style = "baysf"
)
match_trees_on_plot_repsurv_ccirc(
plot_1st, plot_2nd, tree_id_style = "generic"
)
Check for missing values in important columns of the tree list
Description
Check for missing values in important columns of the tree list
Usage
missing_checks(tree_list)
Arguments
tree_list |
variable containing the the tree list |
Value
The input tree_list unchanged when all checks pass. Stops
with an informative error message if any checked column contains
NA values, listing the affected plot_ids.
Constructor for the fe_inventory Class
Description
Should be used by expert users only who know exactly what they are doing.
Other users, please take the function fe_inventory for creating
an object of that class.
Usage
new_fe_inventory(x = tibble::tibble(), ..., class = character())
Arguments
x |
an appropriate |
... |
additional arguments required for enabling subclasses of
|
class |
a character string required for anabling subclasses of
|
Value
An object of class fe_stand
Format Base Tables for Output (Basistabellen)
Description
Format Base Tables for Output (Basistabellen)
Usage
output_base_table(base_table)
Arguments
base_table |
the output from either
|
Value
A data frame containing aggregated information by species group, classified by age or dq class (rows)
Attached attributes
The returned object carries a class_type attribute ("age" or
"dq") recording its class axis, and propagates the
tree_selection attribute set by the *_table_*() functions.
output_base_table_pdf /
output_structure_table_pdf read both (via the internal helper
.table_pdf_meta) instead of taking a type or a cohort/layer
argument.
See Also
Other inventory tables:
base_table_age_class(),
base_table_age_class_main_stand(),
base_table_d_q_class(),
base_table_d_q_class_main_stand(),
output_increment_overall(),
output_structure_table(),
structure_table_age_class(),
structure_table_age_class_main_stand(),
structure_table_d_q_class(),
structure_table_d_q_class_main_stand()
Examples
# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it.
trees_complete <- data_ex3_sample_trees_essentials
base_table <- trees_complete |>
base_table_age_class_main_stand()
base_table |> output_base_table()
Render an Output Base Table in PDF Format
Description
Transform an inventory output base table as generated by
output_base_table into a pdf file that can be exported or
displayed.
Usage
output_base_table_pdf(
x,
tab_title,
output_dir = NA,
meta = NULL,
inventory = NULL,
language = c("ger")
)
Arguments
x |
Input object, must be an output base table as generated with
|
tab_title |
Character, used for the table title and the file name. |
output_dir |
Path to the directory where the information sheet will be stored in. Default is NA; in this case, the file will be written into the temporary directory of the current R session. This directory will, however, only available as long as the session is going on. |
meta |
Optional named list with inventory meta-information to display
above the table. Recognised names: |
inventory |
Optional |
language |
Language of the rendered output. Currently only
|
Details
The user must make sure that the input object x has been generated with
output_base_table, because the function does not check that.
For other objects the function will either produce an error or at least
strange results.
The file name is assembled as
output_base_table_ger_<tab_title>_<type>_<cohort>.pdf. The
<cohort> tag identifies the tree cohort the table represents and is
taken from the tag the base_table_*() functions attach to their
result ("mainstand" for the *_main_stand() functions,
"alllayers" for the general functions called with their default
tree_filter, or a sanitised form of a custom tree_filter
expression). This keeps the four standard variants (main stand / all layers
\times age / diameter classes) in separate, self-describing files
instead of overwriting one another.
The class axis (<type>, age or dq) is likewise read off the object
(the class_type attribute stamped by output_base_table),
and the same cohort tag also selects the disclaimer note below the table
(main-stand note, all-layers note, or - for a custom tree_filter -
a plain "Benutzerdefinierte Auswahl" subtitle without a note). Neither is a
function argument any longer, so they can no longer be set inconsistently
with the actual table content.
Value
The path to the rendered pdf file
See Also
The stages that produce this function's input:
output_base_table, fed by one of the four base tables
base_table_age_class,
base_table_age_class_main_stand,
base_table_d_q_class, and
base_table_d_q_class_main_stand. The structure-table
counterpart of this function is output_structure_table_pdf.
Other pdf_output:
check_pdf_dependencies(),
output_increment_base_table_pdf(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
output_structure_table_pdf(),
pdf_dependencies,
plot_info_sheet_pdf()
Examples
# Build the table (the species cast warnings are a natural side effect of
# the required species grouping)
base_tab <- data_ex3_sample_trees_essentials |>
base_table_age_class_main_stand() |>
output_base_table()
# Render it; output_dir defaults to tempdir(), which is what we want here
pdf_path <- output_base_table_pdf(base_tab, "example_ex3")
basename(pdf_path)
Format Increment Base Tables for Output
Description
Increment counterpart of output_base_table. It restructures the
four-element increment base table into the same display layout (variables to
rows, age or diameter classes to columns, plus the appended “Summe”
cross-species block) used for the static base tables.
Usage
output_increment_base_table(increment_base_table)
Arguments
increment_base_table |
the output from either
|
Details
Because the increment base tables share the exact four-element layout
(list(detail, total, all_species, all_total)) and the same
species_group / class-column convention as the static ones, this
function reuses the generic restructuring of output_base_table.
It is exposed as its own increment-family entry point so the increment output
API stays discoverable and can diverge later (e.g. combining a value with its
confidence interval) without touching the static side.
Value
A data frame with one row per species group and variable, the class
levels as columns plus a total column, and the cross-species
“Summe” block appended at the bottom (tagged with an NA
species_group). The input's collective descriptor and its
meta element are carried through as "collective" and
"meta" attributes on the returned data frame, so the PDF step can
label the collective (Hauptbestand / Alle Schichten / custom) and fill the
header meta block without re-deriving them from the columns.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
inv_b <- data_ex3_sample_fe_inventory
inv_b_trees <- data_ex3_sample_trees_essentials
inc <- inv_increment_gnfi3(inv_b, inv_b_trees)
# Plain and main-stand increment base tables, restructured for output
increment_base_table(inc, by_class = "age") |>
output_increment_base_table()
increment_base_table_main_stand(inc, by_class = "age") |>
output_increment_base_table()
Render an Increment Base Table in PDF Format
Description
Increment counterpart of output_base_table_pdf. Turns the
restructured increment base table from output_increment_base_table
into a formatted PDF, using the unified header (Forstbetrieb name, collective
line, meta line) modelled on the increment overview PDFs.
Usage
output_increment_base_table_pdf(
x,
tab_title,
type = c("age", "dq"),
output_dir = NA,
meta = NULL,
collective = NULL,
ytables_used = NULL,
language = c("ger")
)
Arguments
x |
Input object, the output of |
tab_title |
Character; the Forstbetrieb (or collective) name shown prominently in the header and used for the file name. |
type |
Character, |
output_dir |
Path to the directory the PDF is written to. Default
|
meta |
Optional named list with inventory meta-information for the header
meta block. Recognised names: |
collective |
Optional collective descriptor list
( |
ytables_used |
Optional data frame of the yield tables used (columns
|
language |
Language of the rendered output. Currently only |
Details
The header is built in four parts: the table title, the prominent
Forstbetrieb name (tab_title) right below it, and a flushleft meta
block modelled on the “Zuwachs auf Betriebsebene” overview PDF – a
collective line (“Hauptbestand” / “Alle Schichten” /
“Benutzerdefiniertes Kollektiv: ...”) taken from the table's
collective descriptor, followed by the inventory meta (year, area,
point count and, for repeated inventories, the previous inventory year,
period, Berechnungsmethode and Ergänzungsmethode). A footnote states
whether the table is restricted to the main stand (a partial collective that
allows virtual per-species hectare areas) or not.
The user must make sure that x was produced by
output_increment_base_table; the function does not check that.
Value
The path to the rendered PDF file.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other pdf_output:
check_pdf_dependencies(),
output_base_table_pdf(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
output_structure_table_pdf(),
pdf_dependencies,
plot_info_sheet_pdf()
Examples
# A gnfi3 increment of the ex3 inventory; the ready-made tree list is
# shipped with the package, so the height chain does not have to be run
inc <- inv_increment_gnfi3(
data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials
)
bt <- increment_base_table_main_stand(inc, by_class = "age") |>
output_increment_base_table()
# output_dir defaults to tempdir()
pdf_path <- output_increment_base_table_pdf(
bt,
tab_title = "Forstbetrieb Beispiel",
meta = list(year = 2024, area_ha = 1234, n_plots = 42)
)
basename(pdf_path)
Restructure an Increment Big-Overview Into a Render-Ready Object
Description
Companion to inv_inc_big_overview: takes its rich
multi-list output and produces a render-ready intermediate object that
downstream functions (output_increment_overall_pdf, Shiny
tables, csv exports) can consume without redoing the restructuring.
Usage
output_increment_overall(
bo,
fill_option = c("standard", "min_estimates", "all_estimates"),
user_subtitle = NULL
)
Arguments
bo |
Either an |
fill_option |
Which matched fill_option to display in the
"Single-tree based" block of |
user_subtitle |
Optional character giving an extra subtitle for
the output (e.g. |
Details
The intermediate object collects three parallel tables – one for
matched plots, one for second-only plots, one for the combined
enterprise view – with identical column shape. This lets the renderer
stack them vertically with column-aligned numbers. CI95 columns are
present in all three tables but only filled for the matches_only
table; the gnfi3-based second_only and combined contributions stay
empty by contract (NA) because their per-plot scatter is a
model artefact and an empirical CI would mislead.
Language is deliberately a render-time concern, not a
restructuring-time one: the species_group column is passed
through as the original fe_species_* S3 vector, and the
rendering layer (output_increment_overall_pdf or any
alternative consumer) sets options(fe_spec_lang = ...) plus
format() to choose the display language. This keeps the
intermediate object reusable for multi-language exports from the
same data.
Value
A list with the elements:
- meta
A list with
title(named character vector indexed by language code),user_subtitle,method(the increment method, pulled frombo$method),fill_option,inv_year_prev,inv_year_curr,period_yr, andplot_match_stats(a list withn_total_2nd,n_matched,n_2nd_only,area_total_2nd_ha,area_matched_ha,area_2nd_only_ha).- table_matched
One row per species_group plus a summary row (
is_total_row = TRUE), with the eight numeric columns described below.- table_2nd_only
Same column shape as
table_matched. The "Single-tree based" block holds the gnfi3-backward estimate; the "Summaric" block is allNA(there is no yield-history balance for plots with only one observation).- table_combined
Same column shape; columns hold the per-row sum of
table_matchedandtable_2nd_only. All CI95 columns areNA.
The eight numeric columns in each table:
iv_m3_yr_total_st, ci95_iv_m3_yr_total_st,
iv_m3_ha_yr_st, ci95_iv_m3_ha_yr_st for the
single-tree block; suffix _sum (for "summaric") on the same
four for the yield-history block.
See Also
Other inventory tables:
base_table_age_class(),
base_table_age_class_main_stand(),
base_table_d_q_class(),
base_table_d_q_class_main_stand(),
output_base_table(),
output_structure_table(),
structure_table_age_class(),
structure_table_age_class_main_stand(),
structure_table_d_q_class(),
structure_table_d_q_class_main_stand()
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
# Matching and gap filling of the ex3 pair are shipped ready-made, so the
# overall figures can be built without running the whole chain first.
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
inc_rep <- data_ex3_increment_matched
inc_fl <- data_ex3_increment_fills
inc_sum <- inv_inc_summaric(
inc_rep$tree_increments, inc_fl$fills_forward, inv_a_trees, inv_b_trees
)
bo <- inv_inc_big_overview(
inc_fl, inv_a_trees, inv_b_trees, inv_b,
style = "generic", inc_summaric = inc_sum
)
out <- output_increment_overall(
bo,
fill_option = "standard",
user_subtitle = "Forstbetrieb Neustadt"
)
str(out, max.level = 2)
Render an Increment Overview Table in PDF Format
Description
Thin wrapper around rmarkdown::render() that turns the
restructured intermediate from output_increment_overall into a
nicely formatted PDF. The intermediate's meta block drives the
title, survey-year line, plot-match summary, and the fill_option
subtitle; the three tibbles (table_matched,
table_2nd_only, table_combined) are rendered stacked
below with shared column shape and decimal-point-bound numbers.
Usage
output_increment_overall_pdf(x, output_dir = NA, language = c("ger"))
Arguments
x |
Input object, must be the output of
|
output_dir |
Path to the directory where the PDF will be
written. Default |
language |
Language of the rendered output. Currently only
|
Details
The user must make sure that the input object x has been
generated with output_increment_overall; the function does
not check that. Other objects will either produce an error or
strange results.
Value
The path to the rendered PDF file.
See Also
Other pdf_output:
check_pdf_dependencies(),
output_base_table_pdf(),
output_increment_base_table_pdf(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
output_structure_table_pdf(),
pdf_dependencies,
plot_info_sheet_pdf()
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
# See output_increment_overall() for what the intermediate is built from;
# matching and gap filling of the ex3 pair are shipped ready-made.
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
inc_rep <- data_ex3_increment_matched
inc_fl <- data_ex3_increment_fills
inc_sum <- inv_inc_summaric(
inc_rep$tree_increments, inc_fl$fills_forward, inv_a_trees, inv_b_trees
)
bo <- inv_inc_big_overview(
inc_fl, inv_a_trees, inv_b_trees, inv_b,
style = "generic", inc_summaric = inc_sum
)
out <- output_increment_overall(
bo,
fill_option = "standard",
user_subtitle = "Forstbetrieb Neustadt"
)
# output_dir defaults to tempdir()
pdf_path <- output_increment_overall_pdf(out)
basename(pdf_path)
Restructure a gnfi3 Single-Inventory Increment Overview for Output
Description
Builds the species-level increment overview for the increment estimated from
a single inventory with the tree growth functions of the Third German
National Forest Inventory (gnfi3). The layout corresponds to table B of
output_increment_overall: one row per species group plus a total row,
each carrying the annual volume increment as an absolute total
(zv_m3_yr) and per hectare (zv_m3_ha_yr). Confidence intervals
are not reported here – consistent with the package-wide convention that the
gnfi3 estimate carries no empirical confidence interval (unlike the repeated
survey).
Usage
output_increment_overview_gnfi3(increment_base_table)
Arguments
increment_base_table |
A gnfi3 increment base table, the output of
|
Details
Like the increment base tables, this is the language-neutral intermediate;
species_group stays an fe_species_* vector so the render step
decides the language. The table's collective descriptor is carried
through as a "collective" attribute.
Value
A tibble with one row per species group plus a total row, the
columns species_group, is_total_row, zv_m3_yr and
zv_m3_ha_yr, and a "collective" attribute carried over from
the input.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Examples
inv_b <- data_ex3_sample_fe_inventory
inv_b_trees <- data_ex3_sample_trees_essentials
inc <- inv_increment_gnfi3(inv_b, inv_b_trees)
increment_base_table(inc, by_class = "age") |>
output_increment_overview_gnfi3()
Render a gnfi3 Single-Inventory Increment Overview in PDF Format
Description
Renders the overview from output_increment_overview_gnfi3 as a
PDF, using the unified header (Forstbetrieb name, collective line, meta line)
of the increment table PDFs. The German heading names the method in full
(“Zuwachsfunktionen der 3. Bundeswaldinventur”); a footnote states
that all volume figures are harvested volume under bark (Erntefestmeter ohne
Rinde).
Usage
output_increment_overview_gnfi3_pdf(
x,
tab_title,
output_dir = NA,
meta = NULL,
collective = NULL,
language = c("ger")
)
Arguments
x |
The output of |
tab_title |
Character; the Forstbetrieb name shown prominently in the header and used for the file name. |
output_dir |
Path to the directory the PDF is written to. Default
|
meta |
Optional named list with header meta-information ( |
collective |
Optional collective descriptor overriding the one carried on
|
language |
Language of the rendered output. Currently only |
Value
The path to the rendered PDF file.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other pdf_output:
check_pdf_dependencies(),
output_base_table_pdf(),
output_increment_base_table_pdf(),
output_increment_overall_pdf(),
output_increment_overview_ytables_pdf(),
output_structure_table_pdf(),
pdf_dependencies,
plot_info_sheet_pdf()
Examples
# A gnfi3 increment of the ex3 inventory; the ready-made tree list is
# shipped with the package, so the height chain does not have to be run
ov <- inv_increment_gnfi3(
data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials
) |>
increment_base_table(by_class = "age") |>
output_increment_overview_gnfi3()
# output_dir defaults to tempdir()
pdf_path <- output_increment_overview_gnfi3_pdf(
ov, tab_title = "Forstbetrieb Beispiel"
)
basename(pdf_path)
Render a Yield-Table Increment Overview in PDF Format
Description
Renders the overview of an inv_increment_ytables result as a
PDF with the unified header (Forstbetrieb name, collective line, meta line).
Two tables are shown: the species-group overview (virtual area, mean site
index, increment per ha and total) and a listing of the yield tables used per
species group. A footnote states that all volumes are harvested volume under
bark (Erntefestmeter ohne Rinde) and that the table is restricted to the main
stand.
Usage
output_increment_overview_ytables_pdf(
x,
tab_title,
output_dir = NA,
meta = NULL,
language = c("ger")
)
Arguments
x |
The result of |
tab_title |
Character; the Forstbetrieb name shown prominently in the header and used for the file name. |
output_dir |
Path to the directory the PDF is written to. Default
|
meta |
Optional named list with header meta-information ( |
language |
Language of the rendered output. Currently only |
Value
The path to the rendered PDF file.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
reclassify_pseudo_ingrowth_ccirc(),
tree_inc_repsurv()
Other pdf_output:
check_pdf_dependencies(),
output_base_table_pdf(),
output_increment_base_table_pdf(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3_pdf(),
output_structure_table_pdf(),
pdf_dependencies,
plot_info_sheet_pdf()
Examples
# FeNEU's own yield-table collection covers all current bavrn_state
# species codes; the ForestElementsR collection does not.
inc <- inv_increment_ytables(
data_ex3_sample_fe_inventory,
data_ex3_sample_trees_essentials,
ytables_bavrn_state_var_1_feneu
)
# output_dir defaults to tempdir()
pdf_path <- output_increment_overview_ytables_pdf(
inc, tab_title = "Forstbetrieb Beispiel"
)
basename(pdf_path)
Format Structure Tables for Output (Strukturtabellen)
Description
A data frame with group-wise aggregated inventory information separated per species is returned.
Usage
output_structure_table(structure_table)
Arguments
structure_table |
structure table generated from
|
Value
A data frame containing aggregated information by species group,
separated by age or dq class (rows) and classified by single tree
diameter class (columns). When all_species is supplied, a trailing
cross-species "Summe" group (with an NA species group) is appended.
When species_total is supplied, each species' block gets its own
trailing "Summe" row (grand total across all classes and dbh classes for
that species); when species_dbh_total is also supplied, that same
row's dbh_class columns are filled with the species' per-dbh_class sums/
weighted means across all classes (mirroring BaySF's own report), rather
than being left blank. When grand_total/grand_dbh_total are
supplied, the cross-species "Summe" block gets the equivalent trailing
"Summe" row - the true grand total across every species, class, and dbh
class combined.
Attached attributes
The returned object carries a class_type attribute ("age" or
"dq") recording its class axis, and propagates the
tree_selection attribute set by the *_table_*() functions.
output_base_table_pdf /
output_structure_table_pdf read both (via the internal helper
.table_pdf_meta) instead of taking a type or a cohort/layer
argument.
See Also
Other inventory tables:
base_table_age_class(),
base_table_age_class_main_stand(),
base_table_d_q_class(),
base_table_d_q_class_main_stand(),
output_base_table(),
output_increment_overall(),
structure_table_age_class(),
structure_table_age_class_main_stand(),
structure_table_d_q_class(),
structure_table_d_q_class_main_stand()
Examples
# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it. Three inventory
# points are enough to show the shape of the result, and they keep the
# example quick; the function takes a whole tree list alike.
trees_complete <- data_ex3_sample_trees_essentials |>
dplyr::filter(plot_id %in% unique(plot_id)[1:3])
structure_table <- trees_complete |>
structure_table_age_class_main_stand()
structure_table |> output_structure_table()
Render an Output Structure Table in PDF Format
Description
Transform an inventory output structure table as generated by
output_structure_table into a pdf file that can be exported or
displayed.
Usage
output_structure_table_pdf(
x,
tab_title,
output_dir = NA,
meta = NULL,
inventory = NULL,
language = c("ger")
)
Arguments
x |
Input object, must be an output structure table as generated with
|
tab_title |
Character, used for the table title and the file name. |
output_dir |
Path to the directory where the information sheet will be stored in. Default is NA; in this case, the file will be written into the temporary directory of the current R session. This directory will, however, only available as long as the session is going on. |
meta |
Optional named list with inventory meta-information to display
above the table. Recognised names: |
inventory |
Optional |
language |
Language of the rendered output. Currently only
|
Details
The user must make sure that the input object x has been generated with
output_structure_table, because the function does not check that.
For other objects the function will either produce an error or at least
strange results.
The file name is assembled as
output_structure_table_ger_<tab_title>_<type>_<cohort>.pdf. The
<cohort> tag identifies the tree cohort the table represents and is
taken from the tag the structure_table_*() functions attach to their
result ("mainstand" for the *_main_stand() functions,
"alllayers" for the general functions called with their default
tree_filter, or a sanitised form of a custom tree_filter
expression). This keeps the four standard variants (main stand / all layers
\times age / diameter classes) in separate, self-describing files
instead of overwriting one another.
The class axis (<type>, age or dq) is likewise read off the object
(the class_type attribute stamped by
output_structure_table), and the same cohort tag also selects
the disclaimer note (main-stand note, all-layers note, or - for a custom
tree_filter - a plain "Benutzerdefinierte Auswahl" subtitle without a
note). Neither is a function argument any longer, so they can no longer be
set inconsistently with the actual table content.
Value
The path to the rendered pdf file
See Also
The stages that produce this function's input:
output_structure_table, fed by one of the four structure
tables structure_table_age_class,
structure_table_age_class_main_stand,
structure_table_d_q_class, and
structure_table_d_q_class_main_stand. The base-table
counterpart of this function is output_base_table_pdf.
Other pdf_output:
check_pdf_dependencies(),
output_base_table_pdf(),
output_increment_base_table_pdf(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
pdf_dependencies,
plot_info_sheet_pdf()
Examples
# Build the table (the species cast warnings are a natural side effect of
# the required species grouping)
structure_tab <- data_ex3_sample_trees_essentials |>
structure_table_age_class_main_stand() |>
output_structure_table()
# Render it; output_dir defaults to tempdir(), which is what we want here
pdf_path <- output_structure_table_pdf(structure_tab, "example_ex3")
basename(pdf_path)
Setup for PDF Output Functions
Description
The *_pdf() functions in FeNEU render their tables through
rmarkdown + kableExtra on top of pandoc and a LaTeX
distribution. Pandoc and LaTeX are not R packages; they are external
tools that must be installed once per machine.
R packages
The R-side dependencies are listed as Suggests in the
FeNEU DESCRIPTION. They are not pulled in by
install.packages("FeNEU"); users who want PDF output must
install them explicitly:
install.packages(c("rmarkdown", "kableExtra", "tinytex"))
pandoc
Check via
rmarkdown::pandoc_available()(returnsTRUEwhen a usable pandoc is on the path).RStudio bundles pandoc and rmarkdown picks it up automatically.
A standalone installer for every platform is available at https://pandoc.org/installing.html. On macOS, also
brew install pandoc; on Debian/Ubuntu,apt install pandoc.
LaTeX
The easiest path for R users is tinytex:
install.packages("tinytex") tinytex::install_tinytex()The second call downloads a small LaTeX distribution (~ 300 MB) to the user's home directory. From then on, missing LaTeX packages required by FeNEU's templates (siunitx, booktabs, makecell, longtable, ...) are fetched automatically when a PDF is rendered.
Alternatively, any TeX Live or MiKTeX installation works as long as those LaTeX packages are available.
Diagnostic
To verify the environment before rendering a first PDF:
rmarkdown::pandoc_available() # pandoc on PATH?
rmarkdown::pandoc_version() # which version?
tinytex::is_tinytex() # tinytex installed?
Sys.which("pdflatex") # latex on PATH?
See Also
Other pdf_output:
check_pdf_dependencies(),
output_base_table_pdf(),
output_increment_base_table_pdf(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
output_structure_table_pdf(),
plot_info_sheet_pdf()
Examples
# See whether everything is in place to render a FeNEU PDF
rmarkdown::pandoc_available()
requireNamespace("kableExtra", quietly = TRUE)
Aggregate Inventory Data on Plot Level for Yield Table Application
Description
The aggregation includes only the main stand (layer key 1 and non-removal trees).
Usage
plot_agg_for_yt(x)
Arguments
x |
Tree data frame as pulled from an |
Details
One cohort is one species on one inventory plot: a yield-table increment is estimated for the main stand of a plot, split into the ideal (virtual monospecific) area of each species. Such a cohort has one age and one quadratic mean diameter by construction, so the class a report groups by is a label attached to the cohort, never part of its definition. Both labels are therefore carried here, and the estimate is the same whichever of them a table is later grouped by.
Value
An aggregated data frame with the plot level information required for
applying yield tables, one row per plot and species, carrying both
age_class and d_q_class.
Aggregate 3rd German NFI Tree Increment Estimates on Inventory Plot Level
Description
Single tree increments area aggregated to ha values per species group and layer on plot level (but NOT ha values on species group level)
Usage
plot_inc_gnfi_2012(x)
Arguments
x |
A data frame generated with |
Value
A data frame representing a plot level aggregation of the single
tree level input x
Render an Information Sheet for an Inventory Plot as a PDF File
Description
Render an Information Sheet for an Inventory Plot as a PDF File
Usage
plot_info_sheet_pdf(
x,
title = NA,
output_dir = NA,
dbh_scale = 4,
language = c("ger")
)
Arguments
x |
An object of class
|
title |
id or name for the title of the plot and file. Default is NA,
which means that the entry |
output_dir |
Path to the directory where the information sheet will be stored in. Default is NA; in this case, the file will be written into the temporary directory of the current R session. This directory will, however, only available as long as the session is going on. |
dbh_scale |
Factor for oversizing the trees' dbh in the plot |
language |
Language of the rendered output. Currently only
|
Value
The path to the rendered output file
See Also
Other pdf_output:
check_pdf_dependencies(),
output_base_table_pdf(),
output_increment_base_table_pdf(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
output_structure_table_pdf(),
pdf_dependencies
Examples
# One info sheet for the first inventory point of ex3.
# output_dir defaults to tempdir().
file_path <- data_ex3_sample_fe_inventory$plot[[1]] |>
plot_info_sheet_pdf()
basename(file_path)
# Several sheets in one go (not run here -- one render per plot)
# data_ex3_sample_fe_inventory$plot[1:10] |> lapply(plot_info_sheet_pdf)
Print an fe_increment_gnfi3 Object
Description
Print an fe_increment_gnfi3 Object
Usage
## S3 method for class 'fe_increment_gnfi3'
print(x, ...)
Arguments
x |
An |
... |
Other parameters (not used) |
Value
x, invisibly
Examples
inv_increment_gnfi3(
data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials
)
Print an fe_increment_repsurv Object
Description
Print an fe_increment_repsurv Object
Usage
## S3 method for class 'fe_increment_repsurv'
print(x, ...)
Arguments
x |
An |
... |
Not used. |
Value
x, invisibly.
Print an fe_increment_ytables Object
Description
Print an fe_increment_ytables Object
Usage
## S3 method for class 'fe_increment_ytables'
print(x, ...)
Arguments
x |
An |
... |
Other parameters (not used) |
Value
x, invisibly
Examples
inv_increment_ytables(
data_ex3_sample_fe_inventory, data_ex3_sample_trees_essentials,
ytables_bavrn_state_var_1_feneu
)
Sample Inventory Trees With Estimated Heights (Bavarian)
Description
Sample Inventory Trees With Estimated Heights (Bavarian)
Details
These data is mainly provided for internal testing. It is a tibble
that has been created by applying height_complete_inventory
to the pulled tree data frame processed_pulled_sub10, with the
Bavarian standard height curve system (see
h_standard_bv).
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_nfi_sub10,
processed_pulled_sub10
Sample Inventory Trees With Estimated Heights (NFI)
Description
Sample Inventory Trees With Estimated Heights (NFI)
Details
These data is mainly provided for internal testing. It is a tibble
that has been created by applying height_complete_inventory
to the pulled tree data frame processed_pulled_sub10, with the
German National Forest Inventory (NFI) standard height curve system ((see
h_standard_gnfi3).
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_pulled_sub10
Example Inventory as Pulled Trees (10 inventory points)
Description
Example Inventory as Pulled Trees (10 inventory points)
Details
Mainly provided for internal testing. It is a tibble that has been
created by applying pull_trees to the ten-point fe_inventory
object data_ex3_sample_fe_inventory.
See Also
Other example data:
data_ex1_sample_raw,
data_ex2_sample_raw,
data_ex3_increment_interim,
data_ex3_previous_sample_fe_inventory,
data_ex3_sample_fe_inventory,
data_ex3_trees_essentials,
data_ex4_previous_sample_fe_inventory,
data_ex4_sample_fe_inventory,
data_ex5_previous_sample_fe_inventory,
data_ex5_sample_fe_inventory,
data_ex6_standwise_fe_inventory,
data_ex7_standwise_fe_inventory,
data_examples_overview,
inc_sub10_rep_classic,
inc_sub10_rep_end,
inc_sub10_rep_mean,
inc_sub10_rep_trans,
processed_heights_bav_sub10,
processed_heights_nfi_sub10
Pull Center Point Coordinates From an fe_inventory Object
Description
Pull Center Point Coordinates From an fe_inventory Object
Usage
pull_centers(x)
Arguments
x |
An object of class |
Value
An object of class sf with the column plot_id as taken
from the input object x, and a geometry column that represents each
plot's center point. In case the plot column of x does not
contain objects that allow to extract meaningful center coordinates the
resulting geometry will be empty.
Examples
data_ex3_sample_fe_inventory |> pull_centers()
Pull Circle Definitions From an fe_inventory Object
Description
Extracts per-plot slope and minimum circle area from the circle definition
of an fe_inventory object. Useful for reconstructing small-tree
expansion factors or for diagnostic purposes.
Usage
pull_circle_definitions(forest_inventory, .progress = TRUE)
Arguments
forest_inventory |
Object of class |
.progress |
Logical, if TRUE a progress bar is shown. |
Value
Tibble with one row per plot, containing at least
plot_id, slope and min_c_area.
Examples
pull_circle_definitions(data_ex3_sample_fe_inventory)
Generate Layer-Wise Stand Sum and Mean Values per Plot of an fe_inventory Object and Hand them Back as a Tibble
Description
Basically, this function calls the function
stand_sums_static. According to the behaviour
of that function, If the height values provided with an inventory plot are
not complete, all output values that require height for calculation (i.e.
meam and dominant heights, tree volumes) will be NA.
Usage
pull_sums(forest_inventory, hd_dom_method = "Weise", .progress = TRUE)
Arguments
forest_inventory |
An |
hd_dom_method |
Method for calculating the dominant diameter and
dominant height. The default choice is "Weise". See the documentation of
|
.progress |
Logical, if TRUE (default) a progress bar will be shown during execution. Check the documentation of map for more options. |
Value
A tibble containing the calculated sum and mean values
Examples
# Very small example
fe_inv <- data_ex3_sample_fe_inventory[1:3, ]
# Example with incomplete heights
fe_inv |> pull_sums(.progress = FALSE)
# Complete all heights with estimates ...
suppressWarnings(
# Warnings come from intentional species code casts - no problem here
all_trees_with_heights <- fe_inv |>
pull_trees() |>
height_complete_inventory()
)
# ... and run pull_sums() again
fe_inv |>
fill_heights_back(all_trees_with_heights, .progress = FALSE) |>
pull_sums(.progress = FALSE)
Pull All Trees From an fe_inventory Object Into a Tibble
Description
While it has many advantages to keep inventory data in an object of class
fe_inventory, having one large data frame comprising all trees
is more convenient for many standard evaluation purposes, This function
pulls such a data frame (tibble) from an fe_inventory object.
Usage
pull_trees(forest_inventory, small_trees = FALSE, .progress = TRUE)
Arguments
forest_inventory |
Object of class |
small_trees |
|
.progress |
Logical, if TRUE (default) a progress bar will be shown during execution. Check the documentation of map for more options. |
Value
A tibble with one row per tree, holding the trees of all inventory
plots of forest_inventory in a single flat table. It is not an
object of a FeNEU class; the plot each tree belongs to is carried in the
column plot_id instead. The leading columns are plot_id,
area_rep_ha (the area in ha the plot represents), layer_key,
and species_id (an fe_species vector of whatever coding the
inventory uses); they are followed by the tree attributes of the plots'
trees slots, among them tree_id, time_yr,
age_yr, dbh_cm, height_m, removal,
ingrowth, and h_m_tree (whether the height was measured or
estimated).
Two columns are added by this function and are not tree attributes as
such. n_rep_ha is the number of trees per hectare the tree
represents; it comes from the plot but is multiplied here by the tree's
tree_count, so that a record standing for more than one tree is
correctly weighted (tree_count itself is dropped afterwards).
dbh_trshld is the lower DBH limit of the concentric circle the tree
was sampled in; it is NA for plots that are not
fe_ccircle_spatial, i.e. for stand-wise inventories.
With small_trees = TRUE the small trees of all plots are appended
as further rows, with crown_base_height_m, crown_radius_m,
and dbh_trshld set to NA.
Examples
data_ex3_sample_fe_inventory |> pull_trees()
Read Preprocessed Inventory Data Into an fe_inventory (expert dispatcher)
Description
Expert-level function – standard users do not need it. The normal
import path is two calls: the matching raw_to_pre converter for your
raw format, followed by the matching pre_to_fe_inventory reader, which
alone turns the preprocessed on-disk files into a finished
fe_inventory object (see
import_sample_concentric_pre_to_fe_inventory and
import_standwise_relascope_pre_to_fe_inventory).
Usage
read_and_convert_data(
input_path,
inventory_type = c("sample_concentric", "standwise_relascope"),
style = NULL,
coord_sys = NULL,
check_envelope = TRUE
)
Arguments
input_path |
Path of the folder holding the preprocessed input files
(character). The required filenames depend on |
inventory_type |
Character. Which inventory chain to read. One of
|
style |
Character or |
coord_sys |
Character string specifying the coordinate reference system
of the input plot coordinates (used only by
If The geographic systems ( Note that |
check_envelope |
Logical, default |
Details
This function is a convenience dispatcher for expert / programmatic
use – e.g. when the inventory chain has to be chosen at run time from an
argument. It routes to the matching pre_to_fe_inventory step of the two
import chains and derives the correct object_type from the inventory
type, so callers cannot mismatch them:
"sample_concentric"concentric-circle sample inventory ->
fe_ccircle_spatialplots, viaimport_sample_concentric_pre_to_fe_inventory."standwise_relascope"stand-wise relascope (“Winkelzählprobe” / angle-count) inventory ->
fe_standplots, viaimport_standwise_relascope_pre_to_fe_inventory.
The input must already be in the preprocessed on-disk form of the respective
chain (a folder of BaySF-style files for "sample_concentric", a
WZP_Daten.txt for "standwise_relascope"). Raw vendor formats are
brought into that form first by the matching raw_to_pre converter –
see import_sample_concentric_format1_raw_to_pre,
import_sample_concentric_format2_raw_to_pre and
import_standwise_relascope_format1_raw_to_pre.
Value
An fe_inventory object
(fe_ccircle_spatial plots for "sample_concentric",
fe_stand plots for "standwise_relascope").
See Also
import_sample_concentric_pre_to_fe_inventory,
import_standwise_relascope_pre_to_fe_inventory
Examples
# Concentric-circle sample inventory in BaySF-style preprocessed form
inv_path <- system.file("extdata", "data_ex3_sample_pre",
package = "FeNEU")
read_and_convert_data(inv_path, inventory_type = "sample_concentric",
coord_sys = "gk4")
Read Dead wood Data in BaySF Style
Description
Usage
read_deadwood_data_baysf(input_path)
Arguments
input_path |
Path of the input data folder (character) |
Details
Imports raw inventory data from tab-delimited text files. Currently, these data must follow the standard of the Bavarian State Forest(BaySF)
For this version this function is kept independent from the standard importing in functions. It in the future it may be an optional part of import_data_BaySF
Currently, the following text files must be present in the folder
input_path:
- fdinvtot.txt
BaySF-style deadwood inventory file
Value
A list that contains the imported data files (so far only one)
Reclassify Pseudo-Ingrowth Trees on Concentric-Circle Plots
Description
In repeated inventories with concentric sampling circles, trees that grow
across the dbh threshold of the innermost circle (typically 12 cm) between
two surveys are often mis-classified as ingrowth — even though they
physically existed during the first survey, just on the inner circle, where
they may not have been individually identifiable. This function corrects
such pseudo-ingrowth trees so that subsequent steps of the increment
calculation (tree_inc_repsurv and inv_inc_summaric)
treat them as re-measured trees with a circle transition rather than as
fresh ingrowth.
Usage
reclassify_pseudo_ingrowth_ccirc(
matched_trees,
inv_2nd,
inv_2nd_trees,
tree_id_style = c("baysf", "generic"),
inner_circle_non_matchable = FALSE
)
Arguments
matched_trees |
A data frame as produced by
|
inv_2nd |
|
inv_2nd_trees |
Extended tree data frame for the second inventory
(same object that was passed to
|
tree_id_style |
Character string indicating how trees are uniquely
identified on inventory plot level. Must be the same value that was
used when matching. Options are |
inner_circle_non_matchable |
Logical, default |
Details
A tree is classified as pseudo-ingrowth if all of the following hold:
It is currently classified as ingrowth (
tree_exists_1st == FALSEandtree_exists_2nd == TRUE).Its polar distance from the plot centre at the second survey (
Rfromtree_positions) is smaller than the radius of the innermost circle of the plot'scircle_definition.
The innermost circle is treated as perfectly concentric. In practice it is sometimes laid out slightly off-centre (to avoid trampling small trees), but the displacement is random in direction and magnitude, so individual mis-classifications average out across many plots.
For pseudo-ingrowth trees, the first-survey volume is reconstructed via
the gnfi3 growth functions
(d_age_gnfi3,
h_age_gnfi3,
v_gri, and
v_red_harvest_ubark)
over the full inter-survey period
(dt = -(time_yr_2nd - time_yr_1st)). The estimated volume is
clamped at zero. The first-survey representation number is always set
to the inner circle's value, because the very premise of pseudo-ingrowth
identification is that the tree was sampled on the inner circle at the
first survey (Inv-2 position inside r_inner, plus unmatchable). The
gnfi3 back-estimated dbh is only used for the volume; the sampling
circle is a fact of the survey design, not a model output.
The function leaves all other trees in matched_trees untouched.
It always adds the column pseudo_ingrowth_corrected (boolean), with
TRUE for the reclassified trees and FALSE for all others.
This flag is meant to remain visible downstream so consumers can analyse
the corrected subset (e.g. for a separate tree-status category in
aggregation overviews).
Downstream consumer contract:
The per-tree methods (
tree_inc_repsurvwithrep_classic,rep_mean,rep_end,rep_trans) consume the corrected state and benefit from the reclassification — pseudo-ingrowth trees are processed through the standard both-exist circle-transition branches.-
inv_inc_summaricexplicitly undoes the reclassification on its working copy via thepseudo_ingrowth_correctedflag, because the ertragsgeschichtliche balance is by definition built on actually measured volumes and the inv_1 inner-circle cohort was never measured. There the affected trees enter only via the inv_2 volume sum, as they did before the reclassification.
The reclassification is only meaningful when inner-circle trees of the first inventory are inherently unmatchable:
For
tree_id_style == "baysf"this is always the case (BaySF data have no identifiers for inner-circle trees in the first survey).For
tree_id_style == "generic"only when the survey design marks inner-circle identifiers as unreliable. In that case the caller must setinner_circle_non_matchable = TRUEboth here and in the upstreammatch_trees_on_plot_repsurv_ccirccall so that Inv-1 inner-circle trees are dropped from the match.
In all other situations the function simply adds the
pseudo_ingrowth_corrected column as all-FALSE and leaves
the data untouched.
Value
The input matched_trees with two changes:
For pseudo-ingrowth trees:
tree_exists_1stflipped toTRUE;v_hub_m3_1stset to the gnfi3-back-estimated volume (clamped at 0);n_rep_ha_1stset to the representation number corresponding to the back-estimated dbh on the same plot.A new column
pseudo_ingrowth_corrected(logical), withTRUEfor reclassified trees andFALSEfor all others.
Note that tree_id_1st deliberately stays NA on these rows.
The reclassification asserts that the tree existed at inv 1, not
that an individual inv-1 record was identified — there is none, which is
exactly why the tree was unmatchable. A reclassified row therefore carries
tree_exists_1st = TRUE together with tree_id_1st = NA, and
any downstream count that keys on tree_id_1st will not see it. This
is why n_in_both_1st and n_in_both_2nd of
match_tree_statistics differ by exactly the number of
pseudo-ingrowth trees.
The existing v_hub_m3_at_thrsh value is preserved as-is — it
was already correctly computed for the ingrowth case by
calc_v_hub_m3_at_thrsh, and that same threshold volume is what
the circle-transition branch of tree_inc_repsurv needs
after reclassification.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
tree_inc_repsurv()
Other repeated inventory:
harmonize_inv_for_repsurv(),
inv_increment_repsurv_ccirc(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc()
Examples
# Prepare two matching inventories
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
inv_pt_mtch <- match_2_inventories(inv_a, inv_b, "plot_id", "baysf")
mtch_trs <- match_trees_on_inventory_repsurv_ccirc(
inv_pt_mtch, inv_a, inv_b, inv_a_trees, inv_b_trees,
tree_id_style = "baysf"
)
# Reclassify pseudo-ingrowth — default tree_id_style "baysf"
mtch_trs_corr <- reclassify_pseudo_ingrowth_ccirc(
mtch_trs, inv_b, inv_b_trees, tree_id_style = "baysf"
)
sum(mtch_trs_corr$pseudo_ingrowth_corrected)
Wide table of inventory-point counts by plants per point
Description
Usage
reg_points_by_plants_wide(reg_points_long)
Arguments
reg_points_long |
Tibble from |
Details
Converts the long-format output of count_reg_points_by_plants_long()
into a wide table with one row per mixture_class × species_group and
one column per plant-number class.
Value
Wide-format tibble with one row per mixture_class × species_group and
columns n_inv_points_<class> for each plant-number class.
Add Essential Information to Regeneration Data
Description
Usage
regeneration_add_essentials(inv_trees_reg, method = method)
Arguments
inv_trees_reg |
Tibble containing regeneration trees from
|
method |
Character string selecting the species grouping (coding)
applied to |
Details
Adds fixed L43 height classes and a main-stand mixture type to a regeneration
tibble created from BaySF tree data via pull_trees(..., small_trees = TRUE).
No further transformations of stem numbers are performed.
The height classes follow Bavarian forests standard Table L43:
0.2 m - 1.3 m
1.3 m - 5.0 m
The mixture type is joined in from plot-level information derived from the
main stand (e.g. trees with layer_key 1 and 2), typically computed
using pull_trees(..., small_trees = FALSE).
Value
Tibble identical to inv_trees_reg but with two additional
variables:
- hclass_43
L43 height class (0.2-1.3, 1.3-5.0)
- mixture_type_43
Mixture type derived from the main stand
Standardize BaySF fdinvtot column names
Description
Converts raw BaySF Totholz column names to the internal FeNEU / ForestElementsR naming convention used for deadwood processing.
Usage
rename_dead_wood_fdinvtot(output_list)
Arguments
output_list |
List returned by
|
Value
A tibble with standardized column names
Area-Weighted Standard Error and Confidence Interval
Description
Computes the standard error and confidence interval for an area-weighted mean and its corresponding total, based on the ratio estimator approach. This is the standard method for forest inventory data where plots have different representation areas (e.g. due to slope correction in concentric circle designs).
Usage
se_area_weighted(plot_values, area_weights, conf_level = 0.95)
Arguments
plot_values |
Numeric vector of per-hectare values, one per plot (e.g. volume in m3/ha, increment in m3/ha/yr). |
area_weights |
Numeric vector of representation areas in hectares,
same length as |
conf_level |
Confidence level for the interval, default 0.95. |
Details
The area-weighted mean is computed as a ratio estimator:
\hat{R} = \frac{\sum a_i x_i}{\sum a_i}
Its variance is estimated as:
\mathrm{Var}(\hat{R}) = \frac{n}{(n-1)\,(\sum a_i)^2}
\sum a_i^2 (x_i - \hat{R})^2
The total is \hat{Y} = \hat{R} \cdot \sum a_i,
with \mathrm{SE}(\hat{Y}) = \mathrm{SE}(\hat{R}) \cdot \sum a_i.
Confidence intervals use the t-distribution with n - 1 degrees of
freedom. No finite population correction (FPC) is applied. For typical
forest inventories on systematic grids, the sampling fraction n/N is
very small and the FPC is negligible. Omitting it is conservative, i.e. the
standard error is slightly overestimated.
Value
A tibble (one row) with:
- n_plots
Number of plots used
- mean_ha
Area-weighted mean (per hectare)
- se_mean
Standard error of the mean
- margin_mean
Margin of error for the mean (t * SE)
- ci_lo_mean
Lower confidence bound of the mean
- ci_up_mean
Upper confidence bound of the mean
- total
Area-weighted total (mean_ha * total area)
- se_total
Standard error of the total
- margin_total
Margin of error for the total (t * SE)
- ci_lo_total
Lower confidence bound of the total
- ci_up_total
Upper confidence bound of the total
- ci_pct
Margin of error as percentage of the mean
Examples
# Simple example with equal areas
se_area_weighted(c(10, 12, 8, 11), area_weights = c(1, 1, 1, 1))
# Unequal representation areas (e.g. from slope correction)
se_area_weighted(
c(10, 12, 8, 11),
area_weights = c(0.95, 1.00, 0.88, 1.02)
)
Group-Wise Area-Weighted Aggregation
Description
Convenience wrapper around se_area_weighted that takes a
(possibly grouped) data frame with one row per plot per group, a value
column, and an area column, and returns one row per group with all the
columns of se_area_weighted.
Usage
se_area_weighted_grouped(data, value_col, area_col, conf_level = 0.95)
Arguments
data |
A data frame. If grouped via |
value_col |
Character. Name of the per-plot per-hectare value
column (e.g. |
area_col |
Character. Name of the plot's representation area column, in hectares. |
conf_level |
Confidence level for the CI, default 0.95. |
Details
Used as the shared primitive behind several aggregation pipelines in this package (back tables, big_overview, increment summaries). The data frame is expected to be pre-aggregated to one row per plot per group — the caller decides what “per plot” means (e.g. sum over trees in a species group, or a single per-plot quantity).
Value
A tibble with one row per group, the group keys preserved, and
all output columns of se_area_weighted attached.
Examples
df <- tibble::tibble(
group = rep(c("a", "b"), each = 4),
value = c(10, 12, 8, 11, 20, 22, 18, 21),
area = c( 1, 1, 1, 1, 1, 1, 1, 1)
)
df |>
dplyr::group_by(group) |>
se_area_weighted_grouped("value", "area")
Install Missing PDF Rendering Tools
Description
Installs TinyTeX if no LaTeX distribution is found on the current system.
For pandoc, installation must be done manually (see
diagnose_pdf_toolchain for instructions).
Usage
setup_pdf_toolchain()
Value
Invisibly, the result of diagnose_pdf_toolchain after
the setup attempt.
See Also
Examples
## Not run:
# Deliberately not run, and deliberately not merely skipped on the check
# farm either: this installs TinyTeX into the user's own filespace. That
# must never happen unasked, least of all during a package check.
setup_pdf_toolchain()
## End(Not run)
Aggregation of Deadwood Information on User-Defined Grouping Level
Description
Aggregates deadwood data (volume and number per hectare) to any grouping
structure defined by the user. The function mirrors the structure of
single_tree_aggregation() for live trees but uses ha-based deadwood
metrics. Output values are sums of volume and number per hectare and the
corresponding quadratic mean diameter.
Usage
single_dead_tree_aggregation(dead_trees_ext, ...)
Arguments
dead_trees_ext |
Tibble containing deadwood objects with essential variables (d_mean_cm, v_ha, n_ha). |
... |
Grouping variables passed to |
Value
Tibble with aggregated deadwood information on the defined grouping level.
Aggregation of Regeneration Information on User-Defined Grouping Level
Description
Usage
single_regeneration_aggregation(inv_trees_reg, ..., pulled_circles = NULL)
Arguments
inv_trees_reg |
Tibble returned by |
... |
Grouping variables passed to |
pulled_circles |
Optional tibble with circle definitions (one row per
circle), typically the output of |
Details
Aggregates regeneration data (real counts, calculated stems per hectare,
and sampled area) to any grouping structure defined by the user.
Works with the tibble returned by pull_trees(..., small_trees = TRUE)
and uses all trees with layer_key == 3.
If pulled_circles is provided (a tibble of circle definitions with
plot_id, slope and c_area), the function approximates the counted
stems ("erfasst") per group from n_rep_ha and the minimum circle area
per plot by inverting the original expansion formula.
Value
Tibble with aggregated regeneration information on the defined grouping level.
Aggregated Information From Single Tree to Inventory Level by User Defined Grouping
Description
Workhorse function used in several functions which produce base or structure tables
Usage
single_tree_aggregation(
inv_trees_ext,
...,
.sub_plot_areas = FALSE,
.standard_error = TRUE
)
Arguments
inv_trees_ext |
A tibble representing the trees of an inventory (or any
subset), typically the outbput of |
... |
Grouping variables defining the level of aggregation, internally
passed to |
.sub_plot_areas |
Logical, if |
Value
A tibble containing the aggregated information
Summarise Circle Geometry for Regeneration Expansion Factors
Description
Takes a tibble of circle definitions (one row per concentric circle) as
extracted from an fe_inventory object and summarises the geometry
information to the plot level. For each plot, the function returns the
minimum circle area and the plot-level slope where the regeneration is
accounted for
Usage
small_circle_geometry(pulled_circles)
Arguments
pulled_circles |
Tibble with one row per circle, containing
|
Details
The input pulled_circles should contain at least the variables
plot_id, slope and c_area, typically obtained via
pull_circle_definitions(). Geometry columns (sf) should already be
dropped before passing the tibble.
Value
A tibble with one row per plot, containing:
- plot_id
Unique plot identifier
- slope
The plot-level slope (degrees), extracted as the first non-missing slope value per plot
- min_c_area
The minimum circle area of all concentric circles for that plot
Generate a Stand Register (Revierbuch) PDF From an fe_inventory
Description
Creates a multi-page PDF in which each page summarises the forest inventory statistics of one stand. Statistics include stem number, basal area, standing volume, and quadratic mean DBH per tree species and canopy layer. Optionally, annual volume increment, site index (Bonitaet), and stocking level (Bestockungsgrad) are added.
Usage
stand_register_pdf(
fe_inv,
stands_sf = NULL,
stand_id_col = NULL,
tab_title,
output_dir = NA,
fe_inv_prev = NULL,
ytable_selection = NULL,
increment_method = c("none", "ytables", "gnfi"),
dt = 5,
stand_data = NULL,
stand_id_lookup = NULL,
layer_filter = c("OS", "all", "gesamt")
)
Arguments
fe_inv |
An |
stands_sf |
An |
stand_id_col |
Character; name of the column that uniquely identifies a
stand. Required when |
tab_title |
Character; used in the PDF title and output filename. |
output_dir |
Path to the directory where the PDF will be written.
Default is |
fe_inv_prev |
Optional previous (earlier)
|
ytable_selection |
Optional yield table selection data frame mapping
species codes to yield table names. When provided, site index (Bonitaet)
and stocking level (Bestockungsgrad) are computed per species and stand.
See |
increment_method |
Character; one of |
dt |
Numeric; time span in years for the GNFI forward projection.
Only used when |
stand_data |
Optional data frame with stand-level metadata, printed in
the header of each stand's page. It must contain the stand-id column named
by |
stand_id_lookup |
Optional plot-to-stand lookup for stand-wise inventories
(
When both |
layer_filter |
Character; one of |
Details
Stands can be delineated in two ways, and that choice selects the mode:
- Spatially, for sample inventories
Supply
stands_sf, ansfobject of stand polygons, together withstand_id_col. Plots are assigned to stands by intersecting their sampling circles with the polygons.- Tabularly, for stand-wise inventories
Leave
stands_sf = NULL. Stand membership is then taken from a table – eitherstand_id_lookup, or, if that isNULLas well, from the stand id embedded inplot_id("<stpnr>_<stand_id>"). Stand-level attributes come fromstand_data, for instance the table returned byimport_standwise_relascope_format1_metadata. No geometry is needed.
Assigning plots to stands: In the spatial mode, plots whose concentric
sampling circles straddle a stand boundary are split: each tree's
representation factor (n_rep_ha) is multiplied by the fraction of its
sampling circle that falls inside the stand, so a boundary plot contributes
proportionally to both adjacent stands. In the stand-wise mode there is no
geometry and hence no boundary handling – every angle-count point belongs
wholly to exactly one stand.
Volume calculation: Heights are completed via
height_complete_inventory (NFI method) before volume is
estimated with ForestElementsR::v_gri().
Increment estimation: Increment is optional and can come from three
sources. Note that only two of them are values of increment_method;
the repeated-survey increment is selected by supplying fe_inv_prev.
- Repeated survey (
fe_inv_prev) Increment from two inventory periods. Sample inventories only.
increment_method = "ytables"Yield-table-based increment. Also computes per-species site index and stand-level stocking level. Requires
ytable_selection. Available in both modes.increment_method = "gnfi"Increment estimate with the single-tree growth functions of the 3rd German National Forest Inventory. Sample inventories only.
Restrictions in the stand-wise mode: increment_method = "gnfi"
raises an error, and a supplied fe_inv_prev raises a warning and is
ignored (the increment is then omitted). Both need spatially explicit,
repeatedly measured single trees, which stand-wise angle-count inventories do
not provide. Effectively, "none" and "ytables" remain.
Value
The path to the rendered PDF file (invisibly).
Deliberately not a member of the pdf_output family: the Revierbuch is a post-CRAN feature, so this function must not appear in the cross-links of the user-facing PDF functions.
Restructure Deadwood Detail Table to L46-style Output Table
Description
Takes the long-format detail table from
structure_table_deadwood_dclass() and produces a wide-format
structure table similar to the L_46 deadwood tables of the Bavarian
State Forests. The function reshapes diameter classes into columns,
computes totals for volume and number, and adds plot-level expansion
variables (points and representative area). No readable formatting is
applied at this stage.
Usage
structure_deadwood_output_table(deadwood_structure_table, dead_trees_plus)
Arguments
deadwood_structure_table |
Long-format structure table table from
|
dead_trees_plus |
The preprocessed deadwood tibble containing
|
Value
A wide-format tibble with one row per state × species group and one block of columns per diameter class, plus totals and plot-level expansion variables.
Render a Deadwood Structure Output Table in PDF Format
Description
Transform a deadwood structure output table as generated by
structure_deadwood_output_table into a pdf file that can be
exported or displayed.
Usage
structure_deadwood_output_table_pdf(
x,
tab_title,
output_dir = NA,
meta = NULL,
language = c("ger")
)
Arguments
x |
Input object, must be a deadwood structure output table as generated
with |
tab_title |
Character, used for the table title and the file name. |
output_dir |
Path to the directory where the pdf file will be stored.
Default is |
meta |
Optional named list with inventory meta-information to display
above the table. Recognised names: |
language |
Language of the rendered output. Currently only
Deliberately not a member of the pdf_output family: deadwood evaluation is a post-CRAN feature, so this function must not appear in the cross-links of the user-facing PDF functions. |
Details
The user must make sure that the input object x has been generated
with structure_deadwood_output_table, because the function
does not check that. For other objects the function will either produce an
error or at least strange results.
Value
The path to the rendered pdf file.
Restructure Regeneration Table with Mixture Classes (Long Format)
Description
Usage
structure_regeneration_output_table(
inv_dat_trees_ext_reg,
inv_dat_trees_ext,
pulled_circles = NULL
)
Arguments
inv_dat_trees_ext_reg |
Tibble from |
inv_dat_trees_ext |
Tibble from |
pulled_circles |
Optional tibble of circle definitions, typically the
output of |
Details
Computes species mixing classes from the main stand (layer_key == 1)
based on basal area proportions (g_per), then attaches the mixture
class to the regeneration (layer_key == 3), and finally aggregates
regeneration using single_regeneration_aggregation().
All regeneration metrics are then aggregated to the level mixture_class × species_group × hclass_43. In addition, the function computes:
an area-based percentage
percHoe, expressing the share of VVJ area in each group relative to the total VVJ area of the table,the number of sample circles
n_inv_pointsper mixture_class × species_group.
If pulled_circles is provided (a tibble with circle geometry), the
regeneration aggregation will correct the counted stems ("erfasst")
using the inverted expansion formula.
Value
Tibble in long format with one row per
mixture_class × species_group × hclass_43 containing
n_measrured, n_calc_ha, area_ha, percHoe and n_inv_points.
Render a Regeneration Structure Output Table in PDF Format
Description
Usage
structure_regeneration_output_table_pdf(
x,
tab_title,
output_dir = NA,
meta = NULL,
language = c("ger")
)
Arguments
x |
Input object, must be a regeneration structure output table as
generated with |
tab_title |
Character, used for the table title and the file name. |
output_dir |
Path to the directory where the pdf file will be stored.
Default is |
meta |
Optional named list with inventory meta-information to display
above the table. Recognised names: |
language |
Language of the rendered output. Currently only
Deliberately not a member of the pdf_output family: regeneration evaluation is a post-CRAN feature, so this function must not appear in the cross-links of the user-facing PDF functions. |
Details
Transform a regeneration structure output table as generated by
structure_regeneration_output_wide into a pdf file that can be
exported or displayed.
The user must make sure that the input object x has been generated
with structure_regeneration_output_wide, because the function
does not check that. For other objects the function will either produce an
error or at least strange results.
Value
The path to the rendered pdf file.
Restructure Regeneration Aggregation to L43-style Wide Table
Description
Usage
structure_regeneration_output_wide(regen_long, reg_points_long = NULL)
Arguments
regen_long |
Tibble from |
reg_points_long |
Optional tibble from
|
Details
Takes the aggregated long-format regeneration table produced by
structure_regeneration_output_table() and reshapes it into a
wide-format table similar to the Bavarian L43 tables.
The function:
Builds the top block "total" (across all mixture classes)
Binds mixture-level blocks below
Pivots height classes into separate columns using the pattern "{.value}_{hclass_43}"
Computes horizontal sums across height classes for n_measrured, n_calc_ha, area_ha, and percHoe
Derives block-wise
stammzahl_je_haandDominanzfrom the horizontal sumsOptionally joins a wide Probkreise block derived from
count_reg_points_by_plants_long()
Value
Wide-format tibble with one row per mixture_class × species_group,
including all height-class columns, horizontal sum columns,
block-wise stammzahl_je_ha, Dominanz, and (if provided)
the n_inv_points_* columns.
Species Group Information Table by Age Class and Single Tree Diameter Class
Description
Inventory tree data are grouped by species group, age class, and single tree diameter class. A data frame with group-wise aggregated inventory information is returned.
Usage
structure_table_age_class(inv_trees_plus, tree_filter = !.data$removal)
Arguments
inv_trees_plus |
Data frame which covers trees from an inventory (each
row is a tree), typically obtained from an |
tree_filter |
Expression describing which trees to use in the function,
internally passed to |
Value
A list of six data frames. detail holds the aggregated information
by species group, age class, and single tree diameter class. total
aggregates across single tree diameter classes, providing correct weighted
d_q_cm/h_q_m for the total column of each species row.
all_species holds the cross-species aggregation by age class and single
tree diameter class (body of the "Summe" block). all_total aggregates
all_species across single tree diameter classes, providing correct
weighted d_q_cm/h_q_m for the total column of the Summe
block. species_total aggregates across age classes and single tree
diameter classes (one level up from total), i.e. the species-wise
grand total used for the trailing "Summe" row
output_structure_table appends within each species' block.
species_dbh_total aggregates across age classes only (keeping the
single tree diameter class breakdown), providing the per-dbh_class
values shown in that same "Summe" row.
Attached attribute
The returned list carries a tree_selection attribute recording which
tree cohort it represents: "mainstand" for the *_main_stand()
functions, "alllayers" for the general functions called with their
default tree_filter, or the raw tree_filter expression for a
custom filter. output_base_table /
output_structure_table carry this attribute through to their
own output, where the *_pdf() renderers read it for a
self-describing file name and the cohort disclaimer.
See Also
Other inventory tables:
base_table_age_class(),
base_table_age_class_main_stand(),
base_table_d_q_class(),
base_table_d_q_class_main_stand(),
output_base_table(),
output_increment_overall(),
output_structure_table(),
structure_table_age_class_main_stand(),
structure_table_d_q_class(),
structure_table_d_q_class_main_stand()
Examples
# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it. Three inventory
# points are enough to show the shape of the result, and they keep the
# example quick; the function takes a whole tree list alike.
data_ex3_sample_trees_essentials |>
dplyr::filter(plot_id %in% unique(plot_id)[1:3]) |>
structure_table_age_class()
Species Group Information Table by Age Class and Single Tree Diameter Class for the Main Stand Cohort
Description
Inventory tree data are grouped by species group, age class, and single tree diameter class. A data frame with group-wise aggregated inventory information is returned.
Usage
structure_table_age_class_main_stand(inv_trees_plus)
Arguments
inv_trees_plus |
Data frame which covers trees from an inventory (each
row is a tree), typically obtained from an |
Value
A list of six data frames. detail holds the aggregated information
by species group, age class, and single tree diameter class, restricted to
the main stand, including area estimates. total aggregates across single
tree diameter classes, providing correct weighted
d_q_cm/h_q_m for the total column of each species row.
all_species holds the cross-species aggregation by age class and single
tree diameter class (body of the "Summe" block). all_total aggregates
all_species across single tree diameter classes, providing correct
weighted d_q_cm/h_q_m for the total column of the Summe
block. species_total aggregates across age classes and single tree
diameter classes (one level up from total), i.e. the species-wise
grand total used for the trailing "Summe" row
output_structure_table appends within each species' block.
species_dbh_total aggregates across age classes only (keeping the
single tree diameter class breakdown), providing the per-dbh_class
values shown in that same "Summe" row.
Attached attribute
The returned list carries a tree_selection attribute recording which
tree cohort it represents: "mainstand" for the *_main_stand()
functions, "alllayers" for the general functions called with their
default tree_filter, or the raw tree_filter expression for a
custom filter. output_base_table /
output_structure_table carry this attribute through to their
own output, where the *_pdf() renderers read it for a
self-describing file name and the cohort disclaimer.
See Also
Other inventory tables:
base_table_age_class(),
base_table_age_class_main_stand(),
base_table_d_q_class(),
base_table_d_q_class_main_stand(),
output_base_table(),
output_increment_overall(),
output_structure_table(),
structure_table_age_class(),
structure_table_d_q_class(),
structure_table_d_q_class_main_stand()
Examples
# The prepared tree list ships with the package; see
# ?data_ex3_trees_essentials for the chain that builds it. Three inventory
# points are enough to show the shape of the result, and they keep the
# example quick; the function takes a whole tree list alike.
data_ex3_sample_trees_essentials |>
dplyr::filter(plot_id %in% unique(plot_id)[1:3]) |>
structure_table_age_class_main_stand()
Species Group Information Table by Mean Diameter Class and Single Tree Diameter Class
Description
Inventory tree data are grouped by species group, mean diameter class, and single tree diameter class. A data frame with group-wise aggregated inventory information is returned.
Usage
structure_table_d_q_class(
inv_trees_plus,
dclass_back,
tree_filter = !.data$removal
)
Arguments
inv_trees_plus |
Data frame which covers trees from an inventory (each
row is a tree), typically obtained from an |
dclass_back |
Data frame listing quadratic mean diameter classes per
species group and layer on plot level. Typically the output of
|
tree_filter |
Expression describing which trees to use in the function,
internally passed to |
Value
A list of six data frames. detail holds the aggregated information
by species group, mean diameter class, and single tree diameter class.
total aggregates across single tree diameter classes, providing correct
weighted d_q_cm/h_q_m for the total column of each species
row. all_species holds the cross-species aggregation by mean diameter
class and single tree diameter class (body of the "Summe" block). all_total
aggregates all_species across single tree diameter classes, providing
correct weighted d_q_cm/h_q_m for the total column of the
Summe block. species_total aggregates across mean diameter classes and
single tree diameter classes (one level up from total), i.e. the
species-wise grand total used for the trailing "Summe" row
output_structure_table appends within each species' block.
species_dbh_total aggregates across mean diameter classes only (keeping
the single tree diameter class breakdown), providing the per-dbh_class
values shown in that same "Summe" row.
Attached attribute
The returned list carries a tree_selection attribute recording which
tree cohort it represents: "mainstand" for the *_main_stand()
functions, "alllayers" for the general functions called with their
default tree_filter, or the raw tree_filter expression for a
custom filter. output_base_table /
output_structure_table carry this attribute through to their
own output, where the *_pdf() renderers read it for a
self-describing file name and the cohort disclaimer.
See Also
Other inventory tables:
base_table_age_class(),
base_table_age_class_main_stand(),
base_table_d_q_class(),
base_table_d_q_class_main_stand(),
output_base_table(),
output_increment_overall(),
output_structure_table(),
structure_table_age_class(),
structure_table_age_class_main_stand(),
structure_table_d_q_class_main_stand()
Examples
# The prepared tree list is shipped with the package: it is this inventory
# put through pull_trees() -> height_complete_inventory() ->
# fill_heights_back() -> pull_trees() -> trees_add_essentials(). See
# ?data_ex3_trees_essentials for that chain spelled out.
# Three inventory points are enough to show the shape of the result, and
# they keep the example quick; the function takes a whole tree list alike.
trees_with_heights <- data_ex3_sample_trees_essentials |>
dplyr::filter(plot_id %in% unique(plot_id)[1:3])
peg_back_d <- back_table_dclass(trees_with_heights)
structure_table_d_q_class(trees_with_heights, dclass_back = peg_back_d)
Species Group Information Table by Mean Diameter Class and Single Tree Diameter Class
Description
Inventory tree data are grouped by species group, mean diameter class, and single tree diameter class. A data frame with group-wise aggregated inventory information is returned.
Usage
structure_table_d_q_class_main_stand(inv_trees_plus, dclass_back)
Arguments
inv_trees_plus |
Data frame which covers trees from an inventory (each
row is a tree), typically obtained from an |
dclass_back |
Data frame listing quadratic mean diameter classes per
species group and layer on plot level. Typically the output of
|
Details
Very similar aggregation table to the one produced by
structure_table_d_q_class, but restricted to to the main stand
(layer_key == 1) only. It contains, however, estimates of areas covered by
species (sub-)groups and ha-related values o these cohorts. Due the
methodological dubiousness of species area calculations in mixed stands, this
is only done for the main stand (comparably to how this was handled in the
3rd German National Forest Inventory).
Value
A list of six data frames. detail holds the aggregated information
by species group, mean diameter class, and single tree diameter class,
restricted to the main stand, including area estimates. total aggregates
across single tree diameter classes, providing correct weighted
d_q_cm/h_q_m for the total column of each species row.
all_species holds the cross-species aggregation by mean diameter class
and single tree diameter class (body of the "Summe" block). all_total
aggregates all_species across single tree diameter classes, providing
correct weighted d_q_cm/h_q_m for the total column of the
Summe block. species_total aggregates across mean diameter classes and
single tree diameter classes (one level up from total), i.e. the
species-wise grand total used for the trailing "Summe" row
output_structure_table appends within each species' block.
species_dbh_total aggregates across mean diameter classes only (keeping
the single tree diameter class breakdown), providing the per-dbh_class
values shown in that same "Summe" row.
Attached attribute
The returned list carries a tree_selection attribute recording which
tree cohort it represents: "mainstand" for the *_main_stand()
functions, "alllayers" for the general functions called with their
default tree_filter, or the raw tree_filter expression for a
custom filter. output_base_table /
output_structure_table carry this attribute through to their
own output, where the *_pdf() renderers read it for a
self-describing file name and the cohort disclaimer.
See Also
Other inventory tables:
base_table_age_class(),
base_table_age_class_main_stand(),
base_table_d_q_class(),
base_table_d_q_class_main_stand(),
output_base_table(),
output_increment_overall(),
output_structure_table(),
structure_table_age_class(),
structure_table_age_class_main_stand(),
structure_table_d_q_class()
Examples
# The prepared tree list is shipped with the package: it is this inventory
# put through pull_trees() -> height_complete_inventory() ->
# fill_heights_back() -> pull_trees() -> trees_add_essentials(). See
# ?data_ex3_trees_essentials for that chain spelled out.
# Three inventory points are enough to show the shape of the result, and
# they keep the example quick; the function takes a whole tree list alike.
trees_with_heights <- data_ex3_sample_trees_essentials |>
dplyr::filter(plot_id %in% unique(plot_id)[1:3])
peg_back_d <- back_table_dclass(trees_with_heights)
structure_table_d_q_class_main_stand(trees_with_heights, dclass_back = peg_back_d)
Deadwood summary table by species group and diameter class
Description
Produces a structural deadwood summary at the level of species groups and
fixed diameter classes. All metrics are calculated in absolute values
(volume and number) based on representative area and then converted to
percentages on state and species-group level. The resulting table is still
in long format; reshaping to an L46-like wide table is done by
structure_deadwood_output_table().
Usage
structure_table_deadwood_dclass(dead_trees_plus, tree_filter = TRUE)
Arguments
dead_trees_plus |
Tibble with preprocessed deadwood data including
|
tree_filter |
Logical expression selecting the deadwood objects to be
used. Passed to |
Value
A list with two tibbles:
- detail
Long-format table grouped by state × species group × diameter class, including absolute metrics, percentages, and expansion variables.
- total
State × species-group totals (absolute volume and number).
Single Tree Volume Increment Estimation for Pulled Trees using the Methods of the 3rd German National Forest Inventory
Description
Estimates the dbh, height, and volume increment for each tree in a
data frame x, that was generated by pull_trees, applying
height_complete_inventory and
trees_add_essentials to it. For estimating height and dbh
increment, the functions d_age_gnfi3 and
h_age_gnfi3 are used. Volumes for increment
are calculated with the function v_gri.
Usage
tree_inc_gnfi_2012(x, dt = 5)
Arguments
x |
Tree data frame as pulled from an |
dt |
Time span for the estimate (years). Positive values project
forward in time, negative values backward. Default 5 — a period that
empirically works well with the gnfi3 functions across age ranges. For
estimating the recent past on plots with only a single observation
(e.g. in |
Details
The estimate can run in either direction in time, encoded in the sign of
dt: a positive value projects the trees that many years into the
future, a negative value that many years into the past. The volume
increment is averaged on one year (divided by abs(dt)), so the
resulting iv_hub_m3_yr_gnfi3 is positive for a growing tree in
either direction. pmax(0, age_yr + dt) clamps the target age so
that backward estimates stay defined for trees younger than |dt|.
The output columns share the suffix _gnfi3 that flags the
estimation method. This is consistent with the other gnfi3-derived
columns elsewhere in the package (e.g. iv_hub_m3_ha_per_gnfi3 in
the fill-gap pipeline) and leaves the direction of estimation as a
caller-side concern rather than baking it into the column names.
Value
The input data frame x with five additional columns, all
carrying the _gnfi3 suffix:
- dbh_cm_gnfi3:
Estimate for the trees' diameters at the target age (
age_yr + dt, clamped at 0).- height_m_gnfi3:
Estimate for the trees' heights at the target age.
- v_m3_gnfi3:
Tree volume at the target age based on the two preceding columns.
- v_hub_m3_gnfi3:
The same volume reduced to harvested volume under bark via
v_red_harvest_ubark.- iv_hub_m3_yr_gnfi3:
Annual tree volume increment, harvested under bark. For
dt > 0:(v_hub_m3_gnfi3 - v_hub_m3) / dt. Fordt < 0:(v_hub_m3 - v_hub_m3_gnfi3) / abs(dt). Both conventions yield a positive value for a growing tree.
Calculate the Volume Increment of the Single Trees in a Repeated Inventory with a Concentric Sampling Circle Design
Description
Provided for convenience, but typically not called directly but from within
the function inv_increment_repsurv_ccirc.
Usage
tree_inc_repsurv(
matched_trees,
method = c("rep_classic", "rep_mean", "rep_end", "rep_trans"),
clamp_plausible_shrinkage = TRUE
)
Arguments
matched_trees |
A data frame being the output of
|
method |
Character string, choices are |
clamp_plausible_shrinkage |
Logical. If |
Details
Even though the volume increments are calculated on tree level here, they are
upscaled to 1 ha. This is important, because otherwise the increment
represented by trees that change their representation number per ha between
both inventories cannot be calculated correctly. Trees present in the first
survey only always get zero increment; such values can be replaced by
model-based estimates in a subsequent step. The function allows to choose
between four methods of increment calculation (parameter method):
-
rep_classic: The volume increment,iv, of trees that are present in both inventories is calculated asiv=n[2]\cdot v[2]-n[1] \cdot v[1], withnandvbeing the representation number per hectare and the volume of the tree at the first and the second survey, respectively. The volume increment of the ingrowth trees isiv=n[2]*v[2], i.e. such trees contribute to the increment with their full volume. This method is equivalent to the classic stand level increment calculation (German "Ertragsgeschichtlicher Zuwachs"), however, some trees (and plots) may also have negative increments. This might look strange, but is fully valid from a statistical angle of view. -
rep_mean: The volume increment,iv, of trees that are present in both inventories is calculated asiv=(n[2]+n[1])/2\cdot (v[2]-v[1]), and the volume increment of ingrowth trees is calculated asiv=n[2]*(v[2]-v_t), wherev_tis the tree's volume when it crossed the sampling threshold. This method is not compatible to the classic stand level increment calculation. Guaranteesiv>=0whenclamp_plausible_shrinkage = TRUE. -
rep_end: The volume increment,iv, of trees that are present in both inventories is calculated asiv=n[2]\cdot (v[2]-v[1]), and the volume increment of ingrowth trees is calculated asiv=n[2]*(v[2]-v_t), wherev_tis the tree's volume when it crossed the sampling threshold. This method is not compatible to the classic stand level increment calculation. Guaranteesiv>=0whenclamp_plausible_shrinkage = TRUE. -
rep_trans: The volume increment,iv, of trees that are present in both inventories, and did not cross a sampling threshold, is calculated asiv=n\cdot (v[2]-v[1]), withn=n[1]=n[2]. For trees that crossed a sampling threshold, the calculation isiv=n[2]\cdot (v[2]-v_t) + n[1]\cdot (v_t-v[1]). The volume increment of ingrowth trees is calculated asiv=n[2]*(v[2]-v_t), wherev_tis the tree's volume when it crossed the sampling threshold. This method is not compatible to the classic stand level increment calculation and always guaranteesiv>=0(negative volume differences are clamped to zero regardless ofclamp_plausible_shrinkage).
Value
The input data frame with two additional columns:
iv_hub_m3_ha_per_rep and iv_hub_m3_ha_yr_rep. They represent
the periodic and the (mean) annual tree volume increment in m³/ha under
bark and after harvest.
See Also
Other increment:
harmonize_inv_for_repsurv(),
increment_base_table(),
increment_base_table_main_stand(),
increment_ytables_base_table(),
inv_inc_big_overview(),
inv_inc_big_overview_2nd_only(),
inv_inc_big_overview_matches_only(),
inv_inc_fill_gaps_gnfi3(),
inv_inc_summaric(),
inv_inc_tree_2_plot(),
inv_inc_tree_consolidate(),
inv_inc_tree_extend(),
inv_inc_tree_extend_combined(),
inv_increment_gnfi3(),
inv_increment_repeated_survey(),
inv_increment_repsurv_ccirc(),
inv_increment_ytables(),
is_fe_increment_repsurv(),
match_2_inventories(),
match_2_inventories_by_center_coord(),
match_2_inventories_by_plot_id(),
match_plot_statistics(),
match_trees_on_inventory_repsurv_ccirc(),
match_trees_on_plot_repsurv_ccirc(),
output_increment_base_table(),
output_increment_base_table_pdf(),
output_increment_overall(),
output_increment_overall_pdf(),
output_increment_overview_gnfi3(),
output_increment_overview_gnfi3_pdf(),
output_increment_overview_ytables_pdf(),
reclassify_pseudo_ingrowth_ccirc()
Examples
# When called directly, considerable preparation is required
inv_a <- data_ex3_previous_sample_fe_inventory
inv_b <- data_ex3_sample_fe_inventory
# Match inventory points
inv_pt_mtch <- match_2_inventories(inv_a, inv_b, "plot_id", "baysf")
inv_a_trees <- data_ex3_previous_sample_trees_essentials
inv_b_trees <- data_ex3_sample_trees_essentials
# Now, match both inventories on tree level
mtch_trs <- match_trees_on_inventory_repsurv_ccirc(
inv_pt_mtch, inv_a, inv_b, inv_a_trees, inv_b_trees,
tree_id_style = "baysf"
)
# Finally, calculate the increments
tree_inc_repsurv(mtch_trs, method = "rep_classic")
tree_inc_repsurv(mtch_trs, method = "rep_mean")
tree_inc_repsurv(mtch_trs, method = "rep_end")
tree_inc_repsurv(mtch_trs, method = "rep_trans")
Add Essential Information Like Species Groups, DBH-Classes, Basal Areas, and Volumes to a Trees Data Frame
Description
Function for intermediate calculations between pulling a trees data frame
from an fe_inventory object with pull_trees and
making aggregated evaluations and plots. Made for avoiding double
calculations of tree volume, basal area, and species groups.
Usage
trees_add_essentials(
inv_trees,
method = c("WWK", "BaySF"),
dbh_interval = 5,
age_interval = 20
)
Arguments
inv_trees |
Data frame which covers trees from an inventory (each row is
a tree), obtained from an |
method |
Character string indicating the method to be used for the species groups calculation. Default is "WWK", which is the method used for the species coding tum_wwk_short. Additionally "BaySF" is available, for classifying species according to the groups of the Bavarian State Forest Enterprise (bavrn_state_short). |
dbh_interval |
Integer indicating the interval breaks for the dbh
classes to be formed. The breaks are internally handed over
to |
age_interval |
Integer indicating the interval breaks for the age
classes to be formed. The breaks are internally handed over
to |
Value
The original data frame but with the additional columns
- species_group:
Translation of the original species ids into the
fe_species_tum_wwk_short
coding, which is useful for aggregated evaluations,
- dbh_class:
The dbh class each tree belongs to according to
dbh_breaksas an ordered factor,- age_class:
The age class each tree belongs to according to
age_breaksas an ordered factor,- g_m2:
Basal area of each tree in m²,
- v_m3:
Standing wood volume of each tree over bark in m³ (calculated with
v_gri),- v_hub_m3:
Harvested wood volume of each tree under bark in m³ (calculated with
v_red_harvest_ubark).- standing_area_m2:
Tree specific standing areas, calculated with the function
standing_area_gnfi3
Examples
# Complete heights are necessary for trees_add_essentials. The h_q fallback
# warning is expected here (some species x layer groups lack a measured height).
trees_with_heights <- suppressWarnings(
data_ex3_sample_fe_inventory |>
pull_trees() |>
height_complete_inventory(method = "Bavaria") |>
dplyr::mutate(height_m = ifelse(!h_m_tree, h_est_m, height_m))
)
# Actual application
trees_add_essentials(trees_with_heights)
Validate an fe_inventory Object
Description
Regular users will not require this function. Expert users will want to use
it in combination with the constructor new_fe_inventory.
Regular users, please construct fe_inventory objects with
fe_inventory.
Usage
validate_fe_inventory(x)
Arguments
x |
an object that is expected to be a correct |
Value
Returns x, but this function is mainly called for its side
effect which is pointing out any violations of the fe_inventory
object specifications. In case of such violations, the function will
terminate with an error.
Examples
validate_fe_inventory(data_ex4_sample_fe_inventory)
Complete Bavarian-State-Forest Yield-Table Selection
Description
A yield-table selection assigning a ForestElementsR yield table to every
bavrn_state tree species code, for use with
inv_increment_ytables and its overview. It is FeNEU's completed
counterpart to ForestElementsR::ytables_bavrn_state_var_1: that FER
dataset predates the additional bavrn_state tree species codes
introduced in ForestElementsR 3.0.0 and does not cover them, so
inv_increment_ytables aborts on data containing such species
(e.g. recent Bavarian State Forest inventories). This selection covers all
current bavrn_state tree species codes and is therefore the
recommended default for the bavrn_state coding.
Usage
ytables_bavrn_state_var_1_feneu
Format
A tibble with one row per species, and two columns:
- species_id
An
fe_species_bavrn_statevector (ForestElementsR species coding"bavrn_state") identifying the tree species.- ytable_name
(character) The name of the ForestElementsR yield-table object assigned to that species (e.g.
"fe_ytable_spruce_gehrhardt_moderate_1921").
Details
The 20 species not present in the FER selection are assigned a surrogate
yield table by genus / species-group analogy to an already-assigned congener
(e.g. the additional oaks use the oak table, the elms the ash table). Three
assignments are silvicultural judgement calls: the cedars (Atlaszeder,
Libanonzeder) use the larch table, because the Bavarian State Forest counts
them in the larch species group; the Baumhasel uses the birch table, as a
minor broadleaf (“sonstiges Laubholz”). The remaining 45 species keep
exactly the assignments of ForestElementsR::ytables_bavrn_state_var_1.
Source
Extends ForestElementsR::ytables_bavrn_state_var_1 with
surrogate assignments for the tree species codes it does not cover.
See Also
inv_increment_ytables,
ForestElementsR::ytables_bavrn_state_var_1