The event object is used to define events as input for the
derive_extreme_event() and derive_vars_extreme_event() functions.
Usage
event(
dataset_name = NULL,
condition = NULL,
mode = NULL,
order = NULL,
set_values_to = NULL,
keep_source_vars = NULL,
description = NULL
)Arguments
- dataset_name
Dataset name of the dataset to be used as input for the event. The name refers to the dataset specified for
source_datasetsinderive_extreme_event(). If the argument is not specified, the input dataset (dataset) ofderive_extreme_event()is used.- Permitted values
a character scalar
- Default value
NULL
- condition
An unquoted condition for selecting the observations, which will contribute to the extreme event. If the condition contains summary functions like
all(), they are evaluated for each by group separately.- Permitted values
an unquoted condition
- Default value
NULL
- mode
If specified, the first or last observation with respect to
orderis selected for each by group.- Permitted values
"first","last",NULL- Default value
NULL
- order
The specified variables or expressions are used to select the first or last observation if
modeis specified.For handling of
NAs in sorting variables see the "Sort Order" section invignette("generic").- Permitted values
list of expressions created by
exprs(), e.g.,exprs(ADT, desc(AVAL))orNULL- Default value
NULL
- set_values_to
A named list returned by
exprs()defining the variables to be set for the event, e.g.exprs(PARAMCD = "WSP", PARAM = "Worst Sleeping Problems"). The values can be a symbol, a character string, a numeric value,NAor an expression.- Permitted values
a named list of expressions, e.g., created by
exprs()- Default value
NULL
- keep_source_vars
Variables to keep from the source dataset
The specified variables are kept for the selected observations. The variables specified for
by_vars(ofderive_extreme_event()) and created byset_values_toare always kept.- Permitted values
A list of expressions where each element is a symbol or a tidyselect expression, e.g.,
exprs(VISIT, VISITNUM, starts_with("RS")).- Default value
NULL
- description
Description of the event
The description does not affect the derivations where the event is used. It is intended for documentation only.
- Permitted values
a character scalar
- Default value
NULL
