Learn R Programming

sae4health (version 1.2.2)

num_to_admin: Convert Numeric Code to Administrative Level String

Description

This function converts a numerical administrative level into its corresponding string format.

Usage

num_to_admin(num)

Value

A character string representing the administrative level: - 0 is converted to "National". - Positive integers are converted to "Admin-X". - Returns NULL if the input is invalid.

Arguments

num

A single integer representing the administrative level. The value 0 corresponds to "National", while positive integers correspond to "Admin-X".

Examples

Run this code
num_to_admin(0)    # Returns "National"
num_to_admin(1)    # Returns "Admin-1"
num_to_admin(2)    # Returns "Admin-2"

Run the code above in your browser using DataLab