emend_lvl_match: Match the input factor to supplied levels.

View source: R/factor.R

emend_lvl_matchR Documentation

Match the input factor to supplied levels.

Description

Match the input factor to supplied levels.

Usage

emend_lvl_match(.f, levels = NULL, chat = get_default_chat())

Arguments

.f

A vector of characters or a factor.

levels

The levels of the factor.

chat

The chat object defined by ellmer.

Value

A named character vector of standardised category labels, with the class "emend_lvl_match". The names correspond to the original messy categories, and the values are the cleaned versions.

Examples


chat <- ellmer::chat_ollama(model = "llama3.1:8b", seed = 0, echo = "none")
emend_lvl_match(messy$country,
                levels = c("Asia", "Europe", "North America", "Oceania",
                           "South America"),
                chat = chat)



emend documentation built on April 4, 2025, 2:38 a.m.