NA as considered valid and their proportions are calculated.

freq(vec)

Arguments

vec

An atomic vector

Value

A vector of frequencies as proportions with same length as the vector.

Examples

freq(c(1,2,2,2,1,NA))
#> [1] 0.3333333 0.5000000 0.5000000 0.5000000 0.3333333 0.1666667