<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/clean-or-shorten-column-names-while-importing-the-data-itself/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://costaleconomist.blogspot.com/2017/08/clean-or-shorten-column-names-while.html"> Coastal Econometrician Views</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div><span><span>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.</span></span></div>
<p><span> </span>
<div></div>
<div><a rel="nofollow" href="https://i2.wp.com/2.bp.blogspot.com/-D6yYLr789aA/WaWV1RwFfaI/AAAAAAAAAWw/1b1MuGa16GQ1I4MPcGEKolXTrlGmuNhBACLcBGAs/s1600/R_Clean_Names.png?ssl=1" target="_blank"><img border="0" data-original-height="254" src="https://i2.wp.com/2.bp.blogspot.com/-D6yYLr789aA/WaWV1RwFfaI/AAAAAAAAAWw/1b1MuGa16GQ1I4MPcGEKolXTrlGmuNhBACLcBGAs/s1600/R_Clean_Names.png?resize=286%2C254&ssl=1" data-recalc-dims="1" data-original-width="286"></a></div>
<div></div>
<div></div>
<div></div>
<div><span><span></span></span></div>
<div></div>
<div><span><span>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 </span><span>clean_names</span><span>() which can be useful while directly importing the data itself as show in the below example:</span></span><br><span><span>“
<td> library(janitor); newdataobject &lt;-read.csv(“yourcsvfilewithpath.csv”, header=T) %>% clean_names() </td>
<p>” <br><span><span><br></span></span><span><span><span>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 mavuluri.pradeep@gmail or besteconometrician@gmail.com for more details.<br>Find more about author at http://in.linkedin.com/in/pradeepmavuluri</span></span></span><br><span></span></span>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://costaleconomist.blogspot.com/2017/08/clean-or-shorten-column-names-while.html"> Coastal Econometrician Views</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/3oqeOC89e7A" height="1"></a></div></span></div>