model_id_merge: Merge/Split model output tbl 'model_id' column

View source: R/model_id_merge.R

model_id_mergeR Documentation

Merge/Split model output tbl model_id column

Description

Merge/Split model output tbl model_id column

Usage

model_id_merge(tbl, sep = "-")

model_id_split(tbl, sep = "-")

Arguments

tbl

a data.frame or tibble of model output data returned from a query to a ⁠<hub_connection>⁠ object.

sep

character string. Character used as separator when concatenating team_abbr and model_abbr values into a single model_id string or splitting model_id into component team_abbr and model_abbr. When splitting, if multiple instances of the separator exist in a model_id stringing, splitting occurs occurs on the first instance.

Value

tbl with either team_abbr and model_abbr merged into a single model_id column or model_id split into columns team_abbr and model_abbr.

a tibble with model_id column split into separate team_abbr and model_abbr columns

Functions

  • model_id_merge(): merge team_abbr and model_abbr into a single model_id column.

  • model_id_split(): split model_id column into separate team_abbr and model_abbr columns.

Examples

tbl_split <- model_id_split(hub_con_output)
tbl_split

# Merge model_id
tbl_merged <- model_id_merge(tbl_split)
tbl_merged

# Split / Merge using custom separator
tbl_sep <- hub_con_output
tbl_sep$model_id <- gsub("-", "_", tbl_sep$model_id)
tbl_sep <- model_id_split(tbl_sep, sep = "_")
tbl_sep
tbl_sep <- model_id_merge(tbl_sep, sep = "_")
tbl_sep

hubUtils documentation built on Sept. 18, 2024, 5:09 p.m.