remapCategoryOptionCombos: Remap Category Option Combinations

View source: R/remapCategoryOptionCombos.R

remapCategoryOptionCombosR Documentation

Remap Category Option Combinations

Description

Function which converts category option combos from identifier to another. remapCategoryOptionCombos should be supplied a vector of category option combos (names, codes, uids, or shortnames). It will return a vector of another class as specified with the mode_out paramater.

Usage

remapCategoryOptionCombos(
  cocs_in,
  mode_in,
  mode_out,
  d2session = dynGet("d2_default_session", inherits = TRUE)
)

Arguments

cocs_in

A vector of category option combinations.

mode_in

Should be one of code, name,shortName or id. This is the class we are mapping from.

mode_out

Should be one of code,name,shortName or id. This is the class we are mapping to.

d2session

DHIS2 Session id

Value

Returns a vector of category option combos of the mode_out type.

Examples

## Not run: 
    d <- d2Parser("myfile.csv", type = "csv")
    d$coc_codes <- remapOUs(d$categoryOptionCombos,
                            mode_in = "id",
                            mode_out = "code")

## End(Not run)


jason-p-pickering/datim-validation documentation built on April 20, 2023, 5:32 a.m.