
Subset a trajectory flow, preserving the contract
Source:R/subset_birddog_flow.R
subset.birddog_flow.RdFilters the trajectories of a flow object while keeping it a valid flow:
$tree and absorbed_into are reattached by transitive bypass (a kept
child points to its nearest kept ancestor; NA if none survives) and
$docs_per_group follows the kept nodes. The result is a view, not a
census: the call is recorded in attr(, "pruned") and shown by print().
Dispatches for any detector whose result inherits from birddog_flow
(the contract class), so future detection methods are subsettable for free.
Usage
# S3 method for class 'birddog_flow'
subset(x, subset, target = NULL, ...)Arguments
- x
A
birddog_flowobject (or a subclass from a future detector).- subset
Logical expression on the columns of
x$trajectories, e.g.size >= 50ortype == "central".- target
Optional character vector of
traj_ids: keep each target and its whole tributary subtree (the watershed). Intersects withsubset.- ...
Ignored (base generic compatibility).
Value
An object of the same class as x, passing validate_flow().
See also
sniff_trajectory_braid(), validate_flow()
Other trajectory detection:
is_flow(),
sniff_trajectory_braid(),
sniff_trajectory_channel(),
sniff_trajectory_dag(),
validate_flow()