get_primary_branches: Extract primary branches from a QSM

View source: R/traits_from_qsm.R

get_primary_branchesR Documentation

Extract primary branches from a QSM

Description

Extract primary branches from a QSM by filtering out the the trunk, and identifying all cylinders where 'branching_order == 1' and are attached to the trunk. Returns a tibble containing the basal diameter and height of attachment points.

Usage

get_primary_branches(qsm)

Arguments

qsm

a QSM loaded using '[load_qsm()]'.

Value

A tibble with one row per primary branch containing:

section

Character string ("branches").

diam_cm

Basal diameter of the branch (cm).

ht_m

Height of branch attachment (m).

volume

Placeholder column (currently 'NA').

Examples

qsm_file = system.file("extdata", "tree_0744_qsm.txt", package='tReeTraits')
qsm = load_qsm(qsm_file)
primary_branches = get_primary_branches(qsm)
#number of primary branches
nrow(primary_branches)

tReeTraits documentation built on Feb. 26, 2026, 1:07 a.m.