Skip to contents

This function takes a data frame (df) and the name of a column (col_name) as input, and returns a modified version of the data frame with an additional abbr column containing the abbreviated versions of the text in the specified column. The abbreviation is done by removing vowels from the words, except if the vowel is the first character of the word. If no column name is specified, the function will use the first character column in the data frame. If the input data frame does not have at least one column, or if the specified column does not exist or is not a character column, the function will stop and return an error message.

Usage

abbreviate_lookup(df, col_name = NULL)

Arguments

df

A data frame that is used as a lookup table. Must have at least one column.

col_name

The name of the column to abbreviate. If NULL, the first character column is used.

Value

A tibble with an additional abbr column containing the abbreviated versions of the text in the specified column.