Learn R Programming

hR (version 0.3.0)

hierarchy: hierarchy

Description

The hierarchy function transforms a standard set of unique employee and supervisor identifiers (employee IDs, email addresses, etc.) into a wide or elongated format that can be used to aggregate employee data by a particular line of leadership (i.e. include everyone who rolls up to Susan).

Usage

hierarchy(ee, supv, format = "long", descending = TRUE)

Value

data table

Arguments

ee

A vector containing unique identifiers for employees.

supv

A vector containing unique identifiers for supervisors. These values should be of the same type as the employee values.

format

character string; either "long" or "wide"; default = "long".

descending

logical; default = TRUE. Should the hierarchy levels be descending (i.e. the top person in the hierarchy is represented at level 1)?

Examples

Run this code

Run the code above in your browser using DataLab