View source: R/small_count_label.r
small_count_label | R Documentation |
This function labels values in a vector as a replacement string if they are smaller than a specified cutoff. The input can be numeric, and the function will return either a modified version of the input vector with small values replaced by a given label, or it will keep the original values otherwise.
small_count_label(var, cutoff, replacement)
var |
A numeric vector. This represents the variable to be checked against the cutoff. |
cutoff |
A numeric value representing the threshold. Values in |
replacement |
A string or a numeric value. If the value in |
A vector with values from var
. Values smaller than the cutoff
will be replaced by the replacement
. If replacement
is a string, the
return type will be character, otherwise, it will remain numeric.
Nicolas Foss, Ed.D., MS
# Example usage of the small_count_label function
small_count_label(c(1, 5, 10), 5, "Below Cutoff")
small_count_label(c(1, 5, 10), 5, 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.