forestgeo / fgeo

[Meta R-package on CRAN] Analyse forest diversity and dynamics
https://forestgeo.github.io/fgeo/.
Other
31 stars 12 forks source link

Correct handling of status in add_status_tree() #212

Open LisaHuelsmann opened 5 years ago

LisaHuelsmann commented 5 years ago

It seems the function add_status_tree() is not properly handling status codes other than A or D. More specifically, all stems (and thus also the corresponding trees) with a status of either G = gone, M = missing or P = prior are considered as alive. I was not able to control for this with the arguments status_a and status_d.

# modified code from the example

stem <- tribble(
  ~CensusID, ~treeID, ~stemID, ~status,
  1,       1,       1,     "P",
  1,       1,       2,     "P",

  1,       2,       3,     "A",
  1,       2,       4,     "D",

  1,       3,       5,     "D",
  1,       3,       6,     "D",

  2,       1,       1,     "A",
  2,       1,       2,     "G",

  2,       2,       3,     "D",
  2,       2,       4,     "G",

  2,       3,       5,     "M",
  2,       3,       6,     "M"
)

add_status_tree(stem)