allometries_calculate: Calculating new variables based on the allometries formula

View source: R/lfcAllometries.R

allometries_calculateR Documentation

Calculating new variables based on the allometries formula

Description

Return a vector with the desired allometry equation calculated

Usage

allometries_calculate(object, ..., allometry_id)

Arguments

object

lfcAllometries object, as created by allometries

...

Must be named. Numeric vectors for the independent variables present in the allometry equation. Each argument must be named as the independent variable the values correspond with. See examples.

allometry_id

character with the unique allometry identifier

See Also

Other Allometries functions: allometries_description(), allometries_get_data(), allometries()

Examples


if (interactive()) {
  library(dplyr)
  allomdb <- allometries()
  allometries_calculate(allomdb, DR = c(0.55, 0.46, 0.37), allometry_id = "BH_287")

  # inside a dplyr mutate, with a different allometry for each species
  iris_foo <- iris |>
    mutate(allom = rep(c("BH_287","BH_288","BH_290"), each = 50)) |>
    select(branch_diameter = Sepal.Length, Species, allom)
  iris_foo

  iris_foo |>
    group_by(Species) |>
    mutate(BH = allometries_calculate(
        allomdb, DR = branch_diameter, allometry_id = first(allom)
    ))
}


MalditoBarbudo/lfcdata documentation built on May 2, 2023, 10:30 p.m.