fix_column_names {fixr}R Documentation

Fix Column Names

Description

This function removes "X." or "X" from the beginning of column names and replaces any "." with "_". It also removes leading/trailing symbols and spaces, and ensures that there is only one underscore between two words. If there are duplicate column names, it appends a number to each duplicate column name to make it unique.

Usage

fix_column_names(data)

Arguments

data

A data frame with improperly formatted column names.

Value

The modified data frame with fixed column names.

Examples

my_data <- data.frame(" Col1" = c(1, 2, 3), "Col.2" = c(4, 5, 6), check.names = FALSE)
fix_column_names(my_data)


[Package fixr version 0.1.0 Index]