Learn R Programming

edibble (version 1.1.0)

fct_generator: Factor name generator

Description

Generate a factor with custom levels and repetitions.

Usage

fct_generator(labels, nlevels)

Value

A factor with custom levels and repetitions.

Arguments

labels

A character vector specifying the custom labels for the factor levels.

nlevels

An integer or a vector of integers indicating the number of repetitions for each label. If a single integer is provided, it is recycled to match the length of labels. If a vector is provided, it should have the same length as labels.

Details

This function creates a factor with custom labels and specified repetitions for each label.

Examples

Run this code
# Example usage of the function
fct_generator(labels = c("A", "B", "C"), nlevels = 3)

Run the code above in your browser using DataLab