branch_code_to_y: Convert a 'branch_code' to a y coordinat in range [0, 1]

View source: R/branch_code_to_y.R

branch_code_to_yR Documentation

Convert a branch_code to a y coordinat in range ⁠[0, 1]⁠

Description

Convert a branch_code to a y coordinat in range ⁠[0, 1]⁠.

Usage

branch_code_to_y(branch_code)

Arguments

branch_code

a species' branching pattern, as checked by check_branch_code, e.g. A, AB, AABA.

Details

The y coordinat is the result of a division:

  • numerator: for a binary value of b (converted from the branch_code, where the A equals a zero, and the B equals a one), the numerator in this division equals ⁠1 + 2b⁠

  • denominator: for a branch_code of length n, the denominator equals 2 ^ n.

Value

a y coordinat in range ⁠[0, 1]⁠

Author(s)

Richèl J.C. Bilderbeek

Examples

branch_code_to_y("A")
branch_code_to_y("AA")
branch_code_to_y("AB")

joshwlambert/DAISIEmainland documentation built on July 14, 2024, 5:40 p.m.