R/drop_twice_dead.R
drop_twice_dead.Rd
Removes trees that were found dead both in the last and previous last censuses. Thus the resulting data set contains trees that in the last census were found either alive or dead for the first time.
drop_twice_dead(vft)
vft | A dataframe -- specifically a ForestGEO ViewFullTable with
variables |
---|
A modified version of the input data set: * With the rows removed of all censuses except the last two. * With the rows removed of trees found dead on both the last and previous last censuses.
Other functions to pick or drop rows of a ForestGEO dataframe: pick_plotname
vft <- tibble::tribble( ~CensusID, ~Treeid, ~Status, 1, 1, "alive", # Irrelevant: not one of the last two censuses 1, 1, "dead", # 1, 2, "alive", # Irrelevant: not one of the last two censuses 1, 2, "alive", # 2, 1, "alive", # Tree is alive: at lease one stem is alive 2, 1, "dead", # 2, 2, "dead", # Tree is dead: all stems are dead. Notice that 2, 2, "dead", # this tree is also dead in census 3. 3, 1, "alive", # Tree is alive: at lease one stem is alive 3, 1, "dead", # 3, 2, "dead", # Tree is dead: all stems are dead. Notice that 3, 2, "dead" # this tree is also dead in census 2. ) # `Status` refers to stems while `status_tree` refers to trees. vft <- fgeo.tool::add_status_tree(vft, status_a = "alive", status_d = "dead") # * Remove all censuses except the last two. # * Remove trees found dead on both the last and previous last censuses. drop_twice_dead(vft)#> # A tibble: 4 x 4 #> CensusID Treeid Status status_tree #> <dbl> <dbl> <chr> <chr> #> 1 2 1 alive alive #> 2 2 1 dead alive #> 3 3 1 alive alive #> 4 3 1 dead alive