<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/a-guide-to-working-with-character-data-in-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2018/06/handling-strings-with-r.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p><a rel="nofollow" href="http://a6.typepad.com/6a0105360ba1c6970c022ad35553ae200c-pi" target="_blank"><img alt="Handlingstringscover" title="Handlingstringscover" src="http://a6.typepad.com/6a0105360ba1c6970c022ad35553ae200c-200wi"></a>R is primarily a language for working with numbers, but we often need to work with text as well. Whether it’s formatting text for reports, or analyzing natural language data, R provides a number of facilities for working with character data. <a rel="nofollow" href="http://www.gastonsanchez.com/r4strings/" target="_blank">Handling Strings with R</a>, a free (CC-BY-NC-SA) e-book by UC Berkeley’s <a rel="nofollow" href="http://www.gastonsanchez.com/" target="_blank">Gaston Sanchez</a>, provides an overview of the ways you can manipulate characters and strings with R. </p>
<p>There are many useful sections in the book, but a few selections include:</p>
<ul>
<li><a rel="nofollow" href="http://www.gastonsanchez.com/r4strings/c-style-formatting.html" target="_blank">C-style formatting</a> — very useful for preparing tabular data for reports</li>
<li><a rel="nofollow" href="http://www.gastonsanchez.com/r4strings/stringr-basics.html" target="_blank">String manipulation with the stringr package</a> — which provides some welcome consistency in handling strings with R</li>
<li><a rel="nofollow" href="http://www.gastonsanchez.com/r4strings/regex1.html" target="_blank">Regular expressions</a> — the savior and/or <a rel="nofollow" href="http://blog.revolutionanalytics.com/2018/04/because-its-friday-regex-games.html" target="_blank">curse</a> for many data extraction problem</li>
</ul>
<p>Note that the book does <em>not</em> cover analysis of natural language data, for which you might want to check out the <a rel="nofollow" href="https://cran.r-project.org/web/views/NaturalLanguageProcessing.html" target="_blank">CRAN Task View on Natural Language Processing</a> or the book <a rel="nofollow" href="https://www.tidytextmining.com/" target="_blank">Text Mining with R: A Tidy Approach</a>. It’s also sadly silent on the topic of <a rel="nofollow" href="http://kevinushey.github.io/blog/2018/02/21/string-encoding-and-r/" target="_blank">character encoding in R</a>, a topic that often causes problems when dealing with text data, especially from international sources. Nonetheless, the book is a really useful overview of working with text in R, and has been updated extensively since it was <a rel="nofollow" href="http://blog.revolutionanalytics.com/2014/03/strings-in-r-free-ebook.html" target="_blank">last published in 2014</a>. You can read <a rel="nofollow" href="http://www.gastonsanchez.com/r4strings/" target="_blank"><em>Handling Strings with R</em></a> at the link below.</p>
<p>Gaston Sanchez: <a rel="nofollow" href="http://www.gastonsanchez.com/r4strings/" target="_blank">Handling Strings with R</a></p>
</div>
	<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://blog.revolutionanalytics.com/2018/06/handling-strings-with-r.html"> Revolutions</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/f9sr0AvhZjM" height="1"></a></div>