safe_names: Sanitize table field names

Description Usage Arguments Value Examples

Description

Removes odd characters from field names and makes them lower case. Converts periods to underscores. Makes table field names safe to use in PostgreSQL databases.

Usage

1

Arguments

names

A vector of strings

Value

A vector of strings with punctuation and spaces removed, and replaced with underscores

Examples

1
2
3
4
x <- c("Isabella", "Andrew", "Graham", "Leigh")
y <- c(10, 25, 19, 36)
df <- data.frame( "First Name" = x, "High score! in 2018" = y)
colnames(df) <- safe_names(colnames(df))

lee269/TFP documentation built on May 14, 2019, 2:08 p.m.