intersect_GroupAssignment {stenR} | R Documentation |
Intersect two GroupAssignment
Description
You can intersect two GroupAssignment with this function.
Usage
intersect_GroupAssignment(
GA1,
GA2,
force_disjoint = TRUE,
force_exhaustive = FALSE
)
Arguments
GA1 , GA2 |
GroupAssignment objects to intersect. No previously intersected objects can be intersected again. |
force_disjoint |
boolean indicating if groups disjointedness should be
forced in case when one observation would end in multiple intersections.
If |
force_exhaustive |
boolean indicating if elements that are not assigned
to any of the intersecting groups should be gathered together in |
Value
GroupAssignment object with intersected groups.
See Also
Other observation grouping functions:
GroupAssignment()
,
extract_observations()
Examples
sex_grouping <- GroupConditions(
conditions_category = "Sex",
"M" ~ sex == "M",
"F" ~ sex == "F",
"O" ~ !sex %in% c("M", "F")
)
age_grouping <- GroupConditions(
conditions_category = "Age",
"to 20" ~ age < 20,
"20 to 40" ~ age >= 20 & age <= 40,
"40 to 60" ~ age >= 40 & age < 60,
force_exhaustive = TRUE,
force_disjoint = FALSE
)
# intersect two distinct GroupAssignements
intersected <- intersect_GroupAssignment(
GA1 = GroupAssignment(HEXACO_60, sex_grouping),
GA2 = GroupAssignment(HEXACO_60, age_grouping),
force_exhaustive = TRUE,
force_disjoint = FALSE
)
summary(intersected)
[Package stenR version 0.6.9 Index]