get_freqs {cat2cat} | R Documentation |
Getting frequencies from a vector with an optional multiplier
Description
getting frequencies for a vector with an optional multiplier.
Usage
get_freqs(x, multiplier = NULL)
Arguments
x |
'vector' categorical variable to summarize. |
multiplier |
'numeric' vector how many times to repeat certain value, additional weights. |
Value
'data.frame' with two columns 'input' 'Freq'
Note
without multiplier variable it is a basic 'table' function wrapped with the 'as.data.frame' function. The 'table' function is used with the 'useNA = "ifany"' argument.
Examples
data("occup", package = "cat2cat")
head(get_freqs(occup$code[occup$year == "2008"]))
head(get_freqs(occup$code[occup$year == "2010"]))
head(
get_freqs(
occup$code[occup$year == "2008"],
occup$multiplier[occup$year == "2008"]
)
)
head(
get_freqs(
occup$code[occup$year == "2010"],
occup$multiplier[occup$year == "2010"]
)
)
[Package cat2cat version 0.4.7 Index]