I often get datasets from collaborators that have non-consistent naming of variables/columns in the dataset. One of my first tasks is to rename them, and I want a solution completely within R to do so.
as.Given <- c("ICUDays","SexCode","MAX_of_MLD","Age.Group")
underscore_lowercase <- c("icu_days", "sex_code", "max_of_mld","age_group")
camelCase <- c("icuDays", "sexCode", "maxOfMld", "ageGroup")
Given the different opinions about naming conventions and in the spirit of what was proposed in Python, what ways are there to go from as.Given
to underscore_lowercase
and/or camelCase
in a user-specified way in R?
Edit: Also found this related post in R / regex, especially the answer of @rengis.