View source: R/derive_var_extreme_flag.R
| derive_var_extreme_flag | R Documentation |
Add a variable flagging the first or last observation within each by group
derive_var_extreme_flag(
dataset,
by_vars,
order,
new_var,
mode,
true_value = "Y",
false_value = NA_character_,
flag_all = FALSE,
check_type = "warning"
)
dataset |
Input dataset The variables specified by the |
by_vars |
Grouping variables |
order |
Sort order The first or last observation is determined with respect to the specified order. For handling of |
new_var |
Variable to add The specified variable is added to the output dataset. It is set to the value
set in |
mode |
Flag mode Determines of the first or last observation is flagged. |
true_value |
True value The value for the specified variable |
false_value |
False value The value for the specified variable |
flag_all |
Flag setting A logical value where if set to |
check_type |
Check uniqueness? If |
For each group (with respect to the variables specified for the
by_vars parameter), new_var is set to "Y" for the first or last observation
(with respect to the order specified for the order parameter and the flag mode
specified for the mode parameter). In the case where the user wants to flag multiple records
of a grouping, for example records that all happen on the same visit and time, the argument
flag_all can be set to TRUE.
Otherwise, new_var is set to NA. Thus, the direction of "worst" is considered fixed for
all parameters in the dataset depending on the order and the mode, i.e. for every
parameter the first or last record will be flagged across the whole dataset.
The input dataset with the new flag variable added
General Derivation Functions for all ADaMs that returns variable appended to dataset:
derive_var_joined_exist_flag(),
derive_var_merged_ef_msrc(),
derive_var_merged_exist_flag(),
derive_var_obs_number(),
derive_var_relative_flag(),
derive_vars_cat(),
derive_vars_computed(),
derive_vars_joined(),
derive_vars_joined_summary(),
derive_vars_merged(),
derive_vars_merged_lookup(),
derive_vars_merged_summary(),
derive_vars_transposed()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.