Constructs a data frame of branch segments for phylogeographic visualization. Each row represents a branch from parent to child node with geographic coordinates and temporal information.

build_branches(
  treedata,
  lon = "location1",
  lat = "location2",
  height = "height_mean",
  digits = 2,
  most_recent_sample = NULL,
  debug = getOption("ggphylogeo.debug", FALSE)
)

Arguments

treedata

treedata object with phylogeographic annotations

lon

name of longitude column (default: "location1")

lat

name of latitude column (default: "location2")

height

column name used for branch ages (default: "height_mean")

digits

number of decimal places for rounding coordinates (default: 2)

most_recent_sample

Date or numeric year (e.g. 2019) used to calibrate ages to actual dates. If NULL (default) no calibration is performed.

debug

logical debug messages

Value

A data.frame with columns: startnode, endnode, lon, lat, lonend, latend, ageParent, age, istip, label