validate_age {capl} | R Documentation |
Check whether an age is valid for CAPL-2.
Description
This function checks whether an age is valid (numeric and between 8 and 12). CAPL-2 scores and interpretations are valid for children between the ages of 8 and 12 years.
Usage
validate_age(x)
Arguments
x |
A numeric vector. |
Details
If x
contains a decimal value that is otherwise valid (e.g., 8.5, 10.1), this function will return the floor()
of the value.
Other capl
functions called by this function include: validate_number()
.
Value
Returns a numeric (integer) vector with a value between 8 and 12 (if valid) or NA (if not valid).
Examples
validate_age(c(7:13, "", NA, "12", 8.5))
# [1] NA 8 9 10 11 12 NA NA NA 12 8
[Package capl version 1.42 Index]