clean_variable_labels: Clean variable labels

View source: R/clean_variable_labels.R

clean_variable_labelsR Documentation

Clean variable labels

Description

This function standardises the labels of all characters of factors in a data.frame. It uses the standardisation implemented by epitrix::clean_labels() in the epitrix package. See ?epitrix::clean_labels for more information.

Usage

clean_variable_labels(x, classes = NULL, ...)

Arguments

x

a data.frame

classes

a vector of class definitions for each of the columns. If this is not provided, the classes will be read from the columns themselves. Practically, this is used in clean_data() to mark columns as protected.

...

further arguments passed to epitrix::clean_labels(); the most important is sep, which refers to the separator used between words, and defaults to the underscore _.

Value

A data.frame with standardised labels for characters and factors.

Author(s)

Thibaut Jombart

Examples


## make toy data
toy_data <- clean_variable_names(messy_data())

## clean variable labels, store in new object, show results
clean_data <- clean_variable_labels(toy_data)
clean_data

reconhub/linelist documentation built on Jan. 1, 2023, 9:39 p.m.