remapOUs: Remap Operating Units

View source: R/remapOUs.R

remapOUsR Documentation

Remap Operating Units

Description

Function which converts mechanism codes, names, or shortnames to another class of identifiers. remapOUs should be supplied a vector of organisation Units (names, codes or shortnames) along with the other required paramaters. It will return a vector of to another class of identifiers.

Usage

remapOUs(
  ous_in,
  organisationUnit,
  mode_in = "code",
  mode_out = "id",
  d2session = dynGet("d2_default_session", inherits = TRUE)
)

Arguments

ous_in

A vector of organisation unit 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 organisation unit UIDs will remap organisation units specified as codes to UIDs

Examples

## Not run: 
d <- d2Parser("myfile.csv",type="csv")
d$ou_names <- remapOUs(d$organisationUnits,mode_in="id",mode_out="shortName")

## End(Not run)


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