Learn R Programming

cat2cat (version 0.4.7)

get_freqs: 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)

Value

`data.frame` with two columns `input` `Freq`

Arguments

x

`vector` categorical variable to summarize.

multiplier

`numeric` vector how many times to repeat certain value, additional weights.

Examples

Run this code
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"]
  )
)

Run the code above in your browser using DataLab