flag_if_group {fgeo.tool} | R Documentation |
Detect and flag based on a predicate applied to a variable by groups.
Description
These functions extend flag_if()
] and detect_if()
to
work by groups defined with dplyr::group_by()
.
Usage
flag_if_group(.data, name, predicate, condition = warn, msg = NULL)
detect_if_group(.data, name, predicate)
Arguments
.data |
A dataframe. |
name |
String. The name of a column of the dataframe. |
predicate |
A predicate function, e.g. |
condition |
A condition function, e.g. |
msg |
String to customize the returned message. |
Value
-
flag_if_group()
: A condition and its first input, invisibly. -
detect_if_group()
: Logical of length 1.
See Also
Other functions to check inputs:
check_crucial_names()
,
is_multiple()
Other functions for developers:
check_crucial_names()
,
extract_insensitive()
,
is_multiple()
,
nms_try_rename()
,
rename_matches()
,
type_ensure()
Examples
tree <- tibble(CensusID = c(1, 2), treeID = c(1, 2))
detect_if_group(tree, "treeID", is_multiple)
flag_if_group(tree, "treeID", is_multiple)
by_censusid <- group_by(tree, CensusID)
detect_if_group(by_censusid, "treeID", is_multiple)
flag_if_group(by_censusid, "treeID", is_multiple)
[Package fgeo.tool version 1.2.9 Index]