standardize_kinder: Standardize Kindergarten code to 0 and other grades to...

View source: R/util.R

standardize_kinderR Documentation

Standardize Kindergarten code to 0 and other grades to integers

Description

standardize_kinder returns an integer vector grade levels.

Usage

standardize_kinder(x, other_codes = NULL)

Arguments

x

a character, integer, or numeric vector of grade levels

other_codes

a vector of alternative codes for kindergarten to be translated to 0

Details

This function simply translates kindergarten codes 13 (from client-based MAP), "K", or a user specified kinder_code from an input vector x to 0 and recasts the input vector to an integer vector.

Value

an integer vector of length(x).

Examples


# Create vector of grades 1 through 13, where 13 = kinder
x <- sample(x=1:13, 100,replace = TRUE)
standardize_kinder(x)

# change 13 to "K"
x2 <- ifelse(x==13, "K", x)
standardize_kinder(x2)

# change "K" to "Kinder"
x3 <- ifelse(x=="K", "Kinder", x)
standardize_kinder(x2, other_codes="Kinder")

almartin82/mapvizieR documentation built on June 3, 2023, 10:53 a.m.