ft_mapping: Create a Mapping Table of Original and Modified Factor Levels

View source: R/two_fct.R

ft_mappingR Documentation

Create a Mapping Table of Original and Modified Factor Levels

Description

Creates a data frame mapping the original factor levels to the modified levels.

Usage

ft_mapping(original_factor, modified_factor)

Arguments

original_factor

The original factor vector before modification.

modified_factor

The modified factor vector after modification.

Value

A data frame containing the mapping of original to modified levels.

Author(s)

Kai Guo

Examples

# Original and modified factor vectors
original_factor <- factor(c('apple', 'banana', 'cherry'))
modified_factor <- factor(c('apple_fruit', 'banana_fruit', 'cherry_fruit'))

# Create mapping table
ft_mapping(original_factor, modified_factor)

fctutils documentation built on Oct. 1, 2024, 1:07 a.m.