ABSTRACT

This chapter deals with standardizing names to join two data frames, regular expressions, calculating correlations, creating an interactive scatterplot, and visualizing a linear regression. Regular expressions are not R-specific. They are implemented in almost every modern programming language – and in many text editors, such as Notepad++ for Windows and TextWrangler for Mac. A user probably does not need a graph to detect a relationship in data where the correlation is more than 0.99. However, it can help to see which candidates under- or over-performed on Election Day compared with their number of local contributors. The chapter’s entire analysis could be contained in an R Markdown document. The advantage of R Markdown is that the user can write his/her story, blog post, press release, or narrative, and incorporate R code within the same document.