Realistic Quantitative Structure Models
Overview
Real Twig is a method to correct branch overestimation in quantitative structure models. Overestimated cylinders are correctly tapered using measured twig diameters of corresponding tree species. Supported quantitative structure modeling software includes 'TreeQSM', 'SimpleForest', 'Treegraph', and 'aRchi'. Also included is a novel database of twig diameters and tools for fractal analysis of point clouds.
New Features
import_leaves(): a new function to import leaves from QSM-FaNNI. The leaves are stored as anrgl::mesh3d()object.export_mesh(): The function now supports multiple 3d mesh formats including,.ply,.objand.stl. It also supports exporting a QSM to Blender using the QSM Blender Addons format.txt.- New database called
twigs_index. This is based on qualitative size classes supported by the literature, making it easier to select a twig radius for tree species without twig measurements. More info can be found in theTwigsvignette. plot_qsm():- Leaf meshes from
import_leaves()oraRchi::add_leaves()can now be plotted with theleavesparameter. Leaf color and transparency can be controlled withlf_colorandlf_alpharespectively. - Now accepts random color palettes for cylinders, points, or triangulation meshes by setting the
*_palette = "random". Additionally, the user can set a random color for each cylinder by setting bothcolorandpaletteto"random". - Transparency options added for point clouds and main stem triangulation mesh with
pt_alphaandtri_alpha. - Point clouds can now be colored by any variable or palette using
pt_colorandpt_palette. The user can set a random color for each point by setting bothpt_colorandpt_palettetorandom. - Any
rgl::mesh3d()objects can now be passed toplot_qsm()with themeshparameter. tree_metrics():modifiedis a standard output in thetreedata frame. This is an average of the binary index of the cylinders modified by Real Twig. TherTwigversion and run date are now also saved asversionandrun_date.
Show all changes in 1.4.0Hide the rest of the changes in 1.4.0
volume_change_pctandarea_change_pctare standard outputs of thetreedata frame. These represent the percent change in total tree volume and surface area usingradiusandraw_radius.vessel_volume,pipe_area,pipe_radius, andtwig_distance_mare standard outputs taken from the base of the QSM.- Added first order branches to the branch distribution metrics to better match the output of TreeQSM. These columns include
_1in their column names. path_fractionis now a standard output.
Improvements
export_mesh(): The function was entirely reworked usingRcppfor fast and efficient mesh export. All functionality that was dependent onrglhas been implemented in custom C++ functions.- Function names now use British English to be consistent with R standards. American spelling will still work interchangeably (e.g.
standardize_qsm()vsstandardise_qsm(). - Some functions have been renamed to follow tidy guidelines and have consistency within rTwig and other R packages (e.g.
qsm_summary()-\>summarise_qsm()). - Fixed a bug in
plot_qsm(), where certain variable names conflicted with internal functions, resulting in an error (issue #12). - Fixed multiple bugs in
tree_metrics(): - Empty azimuth and zenith factors are now filled with 0, instead of being missing.
- Issue #15 occurred because the cylinder verification was at too high a level and could not properly create the cylinder network when an error condition was met.
- Fixed an issue when only a single branch or segment was provided as filtered data, causing the calculations to fail. The user is now show a warning when these edge cases occur.
- Fixed an issue where crown base height calculations would fail if there was only one first order branch present.
- Fixed an issue where disconnected data using
verify = FALSEwould fail crown base calculations due to missing branches (issue #18). run_rtwig(): The user can now usestandardizeandstandardiseinterchangeably.- Updated
Twigsvignette with new info and plots. - Updated
Dictionaryvignette describing all standard outputs fromtree_metrics().
Breaking Changes
import_qsm()is deprecated and has been replaced withimport_treeqsm(). The functionality is unchanged, but the name changed to be explicit about its use.import_qsm()still functions, but will be removed in a future rTwig release.qsm_summary()is deprecated and has been replaced withsummarise_qsm(). The functionality is unchanged, but the name changed to be consistent with tidy guidelines.qsm_summary()still functions, but will be removed in a future rTwig release.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-08
- ERROR12 OK, 1 ERROR2026-06-07
- OK12 OK2026-04-25
Show 5 earlier changesHide 5 earlier changes
- NOTE12 OK, 2 NOTE2026-04-22
- ERROR11 OK, 2 NOTE, 1 ERROR2026-04-18
- NOTE12 OK, 2 NOTE2026-04-10
- ERROR11 OK, 2 NOTE, 1 ERROR2026-04-09
- NOTE12 OK, 2 NOTE2026-03-10
Documentation
- Help pages
- 21 (1 internal)includes a package overview page
- Examples that run
- 88%14 run in a plain check · 2 never run
- Exported functions with examples
- 89%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 33% with a bibliography file
- Box-Dimension HTML
- Dictionary HTML
- Metrics HTML
- Overview HTML
- Twigs HTML
- Validation HTML
Downloads
Repository
- PRs merged (all time)
- not measured
- Median days to close, 50 most recently updated closed issues
- 3
- Median days to close, 50 most recently updated closed PRs
- not measured
Stars over time
Releases over time
Issues over time
Commits over time
9 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/aidanmorales/rtwig on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows
GitHub Pages site last deployed 2026-10-16 · The repository has a site deploy workflow
pkgdown site last built 2026-10-16
Dependencies
Installing rTwig adds 61 packages (33 with compiled code, 62 MB of source tarballs). Heaviest: BH 14 MB, data.table 5.7 MB, bslib 5.6 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- RR 4.5.0 released · 2025-04-11
- 1.4.0Latest2025-03-03 · current release · diff ↗ ·
added 5 exports
import_leaves, import_treeqsm, standardise_qsm, summarise_qsm, summarize_qsm - 1.3.02024-11-21 · diff ↗
- 1.2.0
- 1.1.02024-08-21 · diff ↗ ·
removed 1 export
plot_standadded 4 exports
import_treegraph, run_rtwig, standardize_qsm, tree_metrics - RR 4.4.0 released · 2024-04-24
- 1.0.22024-04-08
- RR 4.3.0 released · 2023-04-21
Package metadata
- First published
- 2024-04-08
- Total releases
- 5 / 2 yrs
- License
- GPL (>= 3) OSI
- Minimum R
- ≥ 3.5.0
- Bundled data
- 2.4 KB / 2 files
- Download size
- 899 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("rTwig")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-22, which the citation names so these numbers can be found later. More on citing and the projects behind them.