The
derive_var_merged_summary()
function has been deprecated in favor of derive_vars_merged_summary().
Usage
derive_var_merged_summary(
dataset,
dataset_add,
by_vars,
new_vars = NULL,
filter_add = NULL,
missing_values = NULL
)Arguments
- dataset
-
Input dataset
The variables specified by the
by_varsargument are expected to be in the dataset.- Permitted values
a dataset, i.e., a
data.frameor tibble- Default value
none
- dataset_add
-
Additional dataset
The variables specified by the
by_varsand the variables used on the left hand sides of thenew_varsarguments are expected.- Permitted values
a dataset, i.e., a
data.frameor tibble- Default value
none
- by_vars
-
Grouping variables
The expressions on the left hand sides of
new_varsare evaluated by the specified variables. Then the resulting values are merged to the input dataset (dataset) by the specified variables.- Permitted values
list of variables created by
exprs(), e.g.,exprs(USUBJID, VISIT)- Default value
none
- new_vars
-
New variables to add
The specified variables are added to the input dataset.
A named list of expressions is expected:
LHS refer to a variable.
RHS refers to the values to set to the variable. This can be a string, a symbol, a numeric value, an expression or NA. If summary functions are used, the values are summarized by the variables specified for
by_vars. Any expression on the RHS must result in a single value per by group.
For example:
- Permitted values
list of variables created by
exprs(), e.g.,exprs(USUBJID, VISIT)- Default value
NULL
- filter_add
-
Filter for additional dataset (
dataset_add)Only observations fulfilling the specified condition are taken into account for summarizing. If the argument is not specified, all observations are considered.
- Permitted values
an unquoted condition, e.g.,
AVISIT == "BASELINE"- Default value
NULL
- missing_values
-
Values for non-matching observations
For observations of the input dataset (
dataset) which do not have a matching observation in the additional dataset (dataset_add) the values of the specified variables are set to the specified value. Only variables specified fornew_varscan be specified formissing_values.- Permitted values
list of named expressions created by a formula using
exprs(), e.g.,exprs(AVALC = VSSTRESC, AVAL = yn_to_numeric(AVALC))- Default value
NULL
Value
The output dataset contains all observations and variables of the
input dataset and additionally the variables specified for new_vars.
Details
The records from the additional dataset (
dataset_add) are restricted to those matching thefilter_addcondition.The new variables (
new_vars) are created for each by group (by_vars) in the additional dataset (dataset_add) by callingsummarize(). I.e., all observations of a by group are summarized to a single observation.The new variables are merged to the input dataset. For observations without a matching observation in the additional dataset the new variables are set to
NA. Observations in the additional dataset which have no matching observation in the input dataset are ignored.
