| pick_drop | R Documentation | 
These functions provide an expressive and convenient way to pick specific
rows from ForestGEO datasets. They allow you to remove missing values (with
na.rm = TRUE) but conservatively default to preserving them. This behavior
is similar to base::subset() and unlike dplyr::filter(). This
conservative default is important because you want want to include missing
trees in your analysis.
pick_dbh_min(data, value, na.rm = FALSE) pick_dbh_max(data, value, na.rm = FALSE) pick_dbh_under(data, value, na.rm = FALSE) pick_dbh_over(data, value, na.rm = FALSE) pick_status(data, value, na.rm = FALSE) drop_status(data, value, na.rm = FALSE)
data | 
 A ForestGEO-like dataframe: A ViewFullTable, tree or stem table.  | 
value | 
 An atomic vector; a single value against to compare each value of the variable encoded in the function's name.  | 
na.rm | 
 Set to   | 
A dataframe similar to .data but including only the rows with
matching conditions.
dplyr::filter(), Extract ([).
Other functions for fgeo census and vft: 
guess_plotdim()
Other functions for fgeo census: 
add_status_tree(),
add_var(),
guess_plotdim()
Other functions for fgeo vft: 
add_status_tree(),
add_subquad(),
add_var(),
guess_plotdim()
Other functions to pick or drop rows of a ForestGEO dataframe: 
pick_main_stem()
# styler: off
census <- tribble(
  ~dbh, ~status,
     0,     "A",
    50,     "A",
   100,     "A",
   150,     "A",
    NA,     "M",
    NA,     "D",
    NA,      NA
  )
# styler: on
# <=
pick_dbh_max(census, 100)
pick_dbh_max(census, 100, na.rm = TRUE)
# >=
pick_dbh_min(census, 100)
pick_dbh_min(census, 100, na.rm = TRUE)
# <
pick_dbh_under(census, 100)
pick_dbh_under(census, 100, na.rm = TRUE)
# >
pick_dbh_over(census, 100)
pick_dbh_over(census, 100, na.rm = TRUE)
# Same, but `subset()` does not let you keep NAs.
subset(census, dbh > 100)
# ==
pick_status(census, "A")
pick_status(census, "A", na.rm = TRUE)
# !=
drop_status(census, "D")
drop_status(census, "D", na.rm = TRUE)
# Compose
pick_dbh_over(
  drop_status(census, "D", na.rm = TRUE),
  100
)
# More readable as a pipiline
census %>%
  drop_status("D", na.rm = TRUE) %>%
  pick_dbh_over(100)
# Also works with ViewFullTables
# styler: off
vft <- tribble(
  ~DBH,   ~Status,
     0,   "alive",
    50,   "alive",
   100,   "alive",
   150,   "alive",
    NA, "missing",
    NA,    "dead",
    NA,        NA
)
# styler: on
pick_dbh_max(vft, 100)
pick_status(vft, "alive", na.rm = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.