Extract a the Maximum Value of a Variable Based on a Filter

pull_max_var(df, max_var = NULL, sel_var = NULL, type_selected = NULL)

Arguments

df

Datatable with the following variables: type and si_dist

max_var

Character string containing the variable name to pull out the maximum R estimate for.

sel_var

Character string indicating the variable to extract

type_selected

The nowcast type to extract.

Value

A character string containing the maximum variable

Examples

df <- data.table::data.table(type = c("nowcast", "other"), var = c(1:10), sel = "test") pull_max_var(df, max_var = "var", sel_var = "var", type_selected = "nowcast")
#> [1] 9