strip_key_prefix: Strip prefixes off keys.

View source: R/key_prefixes.R

strip_key_prefixR Documentation

Strip prefixes off keys.

Description

Keys in the master calendar's cal_key column have prefixes according to the type of calendar entry they represent (e.g., "LAB_" for labs, "CLS_" for classes/reading assignments, "EXAM_" for exams, etc.). This function strips those off.

Usage

strip_key_prefix(x, type, ...)

## S3 method for class 'character'
strip_key_prefix(x, type, ...)

## S3 method for class 'list'
strip_key_prefix(x, type, ...)

## S3 method for class 'data.frame'
strip_key_prefix(df, type, col = "cal_key")

Arguments

x

An object to process.

type

The type of calendar entry to strip (e.g., "class", "lab", etc.)

...

Arguments to pass to specialized methods.

df

The data frame to process.

col

The column where the keys are located (by default "cal_key").

Value

A list or vector frame with the prefixes stripped from the contents.

A data frame with the prefixes stripped from the specified column.

Methods (by class)

  • strip_key_prefix(character): Strip key prefixes from character vector.

  • strip_key_prefix(list): Strip key prefixes from a list of character objects.

  • strip_key_prefix(data.frame): Strip key prefixes from a column in a data frame.

See Also

add_key_prefix

add_key_prefix


jonathan-g/semestr documentation built on Jan. 23, 2025, 3:10 p.m.