rbin_factor_combine: Combine levels

Description Usage Arguments Value Examples

View source: R/rbin-factor.R

Description

Manually combine levels of categorical data.

Usage

1
rbin_factor_combine(data, var, new_var, new_name)

Arguments

data

A data.frame or tibble.

var

An object of class factor.

new_var

A character vector; it should include the names of the levels to be combined.

new_name

Name of the combined level.

Value

A tibble.

Examples

1
2
3
4
5
6
upper <- c("secondary", "tertiary")
out <- rbin_factor_combine(mbank, education, upper, "upper")
table(out$education)

out <- rbin_factor_combine(mbank, education, c("secondary", "tertiary"), "upper")
table(out$education)

rbin documentation built on July 8, 2020, 7:31 p.m.