Learn R Programming

ProfessR (version 2.4-1)

fix.names: Fix Down Loaded Names

Description

Fix names to remove problematic alphanumeric characters like spaces, quotes

Usage

fix.names(nam,  upper=FALSE, lower=FALSE)

Value

string, with quaote replaced with underscore

Arguments

nam

string

upper

logical, TRUE= convert to upper case

lower

logical, TRUE= convert to lower case

Author

Jonathan M. Lees<jonathan.lees@unc.edu>

Details

Currently only space, single and double quotes.

Examples

Run this code

####  examples with embedded quotes are not available
####    because they interfere with R documentation

LAM = "SILENCED LAMB"
fix.names(LAM, lower=TRUE)

LAM = "Silence my Lamb"
fix.names(LAM, upper=TRUE)

LAM = "SILeNCED LAMB"
fix.names(LAM)

###   try with single quote
LAM = "O'brian LAMB"
fix.names(LAM)


Run the code above in your browser using DataLab