percent.RdReturns percentage of the occurance of TRUE values in a vector of logical values.
percent(x, min_valid, max_na)A vector
Minimal number of valid values that is required for calculation. A value between 0 and 1 indicates a proportion of values (e.g., 0.5 = 50 percent of values have to be valid).
Maximum number of NAs that are allowed before returning NA. A value between 0 and 1 indicates a proportion of values (e.g., 0.5 = 50 percent NAs are allowed).
A percentage
If min_valid is provided, the function will only calculate the percentage
if the number of valid (non-NA) values is at least min_valid.
If max_na is provided, the function will only calculate the
percentage if the number of NAs is at most max_na. If the conditions
are not met, NA is returned.
percent(runif(10000) > 0.50)
#> [1] 49.15