GroupAssignment | R Documentation |
Using GroupConditions object, assign observations to one
of the groups. It can export either indices of the observations, or their
unique ID: if column name is provided in id
argument. Mostly used internally
by more complex functions and R6 classes
, but could also be useful
on its own.
GroupAssignment( data, conditions, id, force_disjoint, force_exhaustive, skip_faulty = FALSE, .all = FALSE, ... ) ## S3 method for class 'GroupAssignment' print(x, ...) ## S3 method for class 'GroupAssignment' summary(object, ...)
data |
data.frame containing observations |
conditions |
GroupConditions object |
id |
character name of the column containing unique ID of the observations to assign to each group. If not provided, indices will be used instead. |
force_disjoint |
boolean indicating if groups disjointedness should be
forced in case when one observation would pass conditions for more than one
group. If |
force_exhaustive |
boolean indicating if groups exhausiveness should
be forced in case when there are observations that don't pass any of the provided
conditions. If |
skip_faulty |
boolean should the faulty |
.all |
boolean. If |
... |
additional arguments to be passed to or from method |
x |
object |
object |
|
GroupAssignment object
list of summaries, invisibly
Other observation grouping functions:
extract_observations()
,
intersect_GroupAssignment()
age_grouping <- GroupConditions( conditions_category = "Age", "to 20" ~ age < 20, "20 to 40" ~ age >= 20 & age <= 40, "40 to 60" ~ age >= 40 & age < 60 ) # on basis of GroupConditions create GroupAssignment age_assignment <- GroupAssignment( data = HEXACO_60, age_grouping) print(age_assignment) # overwrite the default settings imposed by `GroupConditions` age_assignment_forced <- GroupAssignment( data = HEXACO_60, age_grouping, force_exhaustive = TRUE) summary(age_assignment_forced) # you can also use other unique identifier from your data age_assignment_forced_w_id <- GroupAssignment( data = HEXACO_60, age_grouping, id = "user_id", force_exhaustive = TRUE) summary(age_assignment_forced_w_id)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.