validate_gender {capl}R Documentation

Check whether a vector can be classified as "girl" or "boy".

Description

This function checks whether a vector can be classified as "girl" or "boy".

Usage

validate_gender(x)

Arguments

x

A vector (see Examples for valid values).

Value

Returns a character vector with values of "girl" or "boy" (if valid) or NA (if not valid).

Examples

validate_gender(c("Girl", "GIRL", "g", "G", "Female", "f", "F", "", NA, 1))

# [1] "girl" "girl" "girl" "girl" "girl" "girl" "girl" NA     NA     "girl"

validate_gender(c("Boy", "BOY", "b", "B", "Male", "m", "M", "", NA, 0))

# [1] "boy" "boy" "boy" "boy" "boy" "boy" "boy" NA    NA    "boy"


[Package capl version 1.39 Index]