Learn R Programming

GCubeR (version 0.1.3)

c150_c130: Convert circumference between 1.50 m and 1.30 m

Description

Computes stem circumference at 1.30 m (c130, in cm) from circumference at 1.50 m (c150, in cm) using species-specific linear coefficients stored in the reference table c150_c130_coeff. If only c130 is available, the function back-computes c150 using the inverse of the same equation.

Usage

c150_c130(data, output = NULL)

Value

A data.frame identical to the input but augmented with:

  • species-specific coefficients and validity ranges,

  • both c150 and c130 columns completed whenever possible.

Arguments

data

A data.frame containing at least:

  • species_code: tree species code,

  • c150: stem circumference at 1.50 m (cm), or

  • c130: stem circumference at 1.30 m (cm).

output

Optional file path where the resulting data frame should be exported as a CSV. If NULL (default), no file is written. Export is handled by the utility function export_output() and failures trigger warnings without interrupting execution.

Supported species

The following species codes are supported by c150_c130:

  • "QUERCUS_SP", "QUERCUS_ROBUR", "QUERCUS_PETRAEA", "QUERCUS_PUBESCENS", "QUERCUS_RUBRA"

  • "FAGUS_SYLVATICA", "ACER_PSEUDOPLATANUS", "FRAXINUS_EXCELSIOR", "ULMUS_SP", "PRUNUS_AVIUM"

  • "BETULA_SP", "ALNUS_GLUTINOSA", "LARIX_SP", "PINUS_SYLVESTRIS", "CRATAEGUS_SP"

  • "PRUNUS_SP", "CARPINUS_SP", "CASTANEA_SATIVA", "CORYLUS_AVELLANA", "MALUS_SP"

  • "PYRUS_SP", "SORBUS_ARIA", "SAMBUCUS_SP", "RHAMNUS_FRANGULA", "PRUNUS_CERASUS"

  • "ALNUS_INCANA", "POPULUSxCANADENSIS", "POPULUS_TREMULA", "PINUS_NIGRA", "PINUS_LARICIO"

  • "TAXUS_BACCATA", "ACER_PLATANOIDES", "ACER_CAMPESTRE", "SORBUS_AUCUPARIA", "JUNGLANS_SP"

  • "TILLIA_SP", "AESCULUS_HIPPOCASTANUM", "ROBINIA_PSEUDOACACIA", "SALIX_SP"

Details

The conversion equation is: $$ c130 = a \cdot c150 + b $$ where \(a\) and \(b\) are species-specific coefficients.

The function performs the following steps:

  • checks that the input data frame contains the required variables species_code and at least one of c150 or c130,

  • validates that numeric values are provided,

  • verifies that all species are available in the c150_c130_coeff reference table and issues a warning otherwise,

  • merges the input with c150_c130_coeff to retrieve coefficients and species-specific validity ranges (min_c150, max_c150),

  • warns when circumference values fall outside the recommended range,

  • computes missing c130 from c150, or missing c150 from c130,

  • returns the augmented data frame with both columns completed.

See Also

c150_c130_coeff for species-specific coefficients.

Examples

Run this code
df <- data.frame(
  species_code = c("PINUS_SYLVESTRIS", "QUERCUS_RUBRA"),
  c150 = c(145, NA),
  c130 = c(NA, 156)
)
c150_c130(df)

Run the code above in your browser using DataLab