Clean or shorten Column names while importing the data itself
When it comes to clumsy column headers namely., wide ones with spaces and special characters, I see many get panic and change the headers in the source file, which is an awkward option given variety of alternatives that exist in R for handling them.
One easy handling of such scenarios is using library(janitor), as name suggested can be employed for cleaning and maintaining. Janitor has function by name clean_names() which can be useful while directly importing the data itself as show in the below example:“
| library(janitor); newdataobject <- read.csv(“yourcsvfilewithpath.csv”, header=T) %>% clean_names()
Author undertook several projects, courses and programs in data sciences for more than a decade, views expressed here are from his industry experience. He can be reached at [email protected] or [email protected] for more details.
Find more about author at http://in.linkedin.com/in/pradeepmavuluri
If you got this far, why not subscribe for updates
from the site? Choose your flavor: e-mail
, or facebook