View source: R/get_correction_factors.R

get_correction_factors | R Documentation |

Get correction factors for an angle count table (i.e. a
`data.frame`

) and a corresponding boundary
table (i.e. a `data.frame`

).

```
get_correction_factors(
angle_counts,
boundaries,
verbose = TRUE,
stop_on_error = FALSE,
skip_check = FALSE,
counting_factor = 4,
is_ti_round = TRUE
)
```

`angle_counts` |
A |

`boundaries` |
A |

`verbose` |
Be verbose? |

`stop_on_error` |
Passed to |

`skip_check` |
We usually check if the angle counts are suitable (for example whether a diameter at breast height, a horizontal distance and an azimuth measurement are given). Skip this check? This might be of interest if you want to check whether another plot with no dbh recorded (for example a corner) is intersected by a boundary. |

`counting_factor` |
The basal area factor used in counting the trees. For tally trees in the German national forest inventory its value is 4 [m^2]. |

`is_ti_round` |
When checking for the boundary circle of a tree to include the center of the plot: round that circle's radius to the unit (i.e. [cm]) as done by Thuenen Institute? |

The columns in the names have to be named according to the values of
`getOption("treePlotArea")`

.
If they do not: you can either rename the columns
or set the option accordingly, probably using `set_options`

.

A `data.frame`

containing the correction factors and a
status giving information on possibly errors.

set_options

```
data("trees", "boundaries", package = "treePlotArea")
# For CRAN's sake: draw a subset
tracts <- c(sample(boundaries[["tnr"]], 20), 10056)
# Calculate correction factors
trees <- subset(trees, tnr %in% tracts)
boundaries <- subset(boundaries, tnr %in% tracts)
angle_counts <- bw2bwi2022de(trees)
validate_data(x = boundaries)
validate_data(x = angle_counts)
boundary_polygons <- get_boundary_polygons(boundaries)
correction_factors <- get_correction_factors(angle_counts, boundary_polygons)
summary(correction_factors$status)
# Select valid angle count trees only
valid_angle_counts <- select_valid_angle_count_trees(angle_counts)
correction_factors <- get_correction_factors(valid_angle_counts,
boundary_polygons)
summary(correction_factors$status)
# Select a single tree
tnr <- 10056
enr <- 4
bnr <- 3
tree <- valid_angle_counts[valid_angle_counts[["tnr"]] == tnr &
valid_angle_counts[["enr"]] == enr &
valid_angle_counts[["bnr"]] == bnr, TRUE]
bounds <- boundaries[boundaries[["tnr"]] == tnr & boundaries[["enr"]] == enr,
TRUE]
get_correction_factors(tree, bounds)
# Deadwood plots:
dead_wood_plots <- unique(trees[TRUE, c("tnr", "enr")])
dead_wood_plots[["bnr"]] <- 0
dead_wood_plots[["hori"]] <- 0
dead_wood_plots[["azi"]] <- 0
dead_wood_plots[["bhd"]] <- 200
get_correction_factors(dead_wood_plots, boundary_polygons,
skip_check = TRUE)
# Set the deadwood plot's radius to 500 mm
dead_wood_plots[["bhd"]] <- 5000
# The counting factor has unit square meters per area.
# Area is hardcoded to 10000 [square meters], so to get a plot radius that's
# equal to the dbh, we need 2 * sqrt(counting_factor) / sqrt(10000) to be
# equal to 1.
get_correction_factors(dead_wood_plots, boundary_polygons,
skip_check = TRUE,
counting_factor = 2500)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.