fct_glue_labels: Format the labels of a factor

View source: R/vectors.R

fct_glue_labelsR Documentation

Format the labels of a factor

Description

Format the labels of a factor

Usage

fct_glue_labels(xs, fmt = "{levels}", first_fmt = fmt)

fct_add_counts(xs, fmt = "{levels} ({counts})", first_fmt = fmt)

Arguments

xs

a factor

fmt

glue-style format to use. Defaults to "{levels}" for fct_glue_labels() and "{levels} ({counts})" for fct_add_counts().

first_fmt

glue-style format to use for very first label. Defaults to value of fmt.

Details

At this point, only the magic variables "{levels}" and "{counts}" are available ". In principle, others could be defined. fct_add_counts() is a special case of fct_glue_labels().

Value

a factor with the labels updated


tjmahr/tjmisc documentation built on Feb. 8, 2023, 12:21 p.m.