remapMechs: Remap Mechanisms

View source: R/remapMechs.R

remapMechsR Documentation

Remap Mechanisms

Description

Function which converts mechanism codes, names or shortnames to UIDs. remapMechs should be supplied a vector of data mechanisms (names, codes or shortnames) along with the other required paramaters. It will return a vector of UIDs.

Usage

remapMechs(
  mechs_in,
  organisationUnit,
  mode_in = "code",
  mode_out = "id",
  d2session = dynGet("d2_default_session", inherits = TRUE)
)

Arguments

mechs_in

A vector of data element identifiers (codes, names, or shortNames).

organisationUnit

Organisation unit ancestor.

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 mechanism UIDs

Examples

## Not run: 
d <- d2Parser("myfile.csv",type="csv")
#Add a new column with organisation unit short names.
d$mech_names <- remapMechs(d$attributeOptionCombo,
                           mode_in="id",
                           mode_out="code")

## End(Not run)

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