ABSTRACT

Data is one of the highlights of Election Day coverage, whether a journalist works at a newspaper, radio station, TV, or community blog. Many others such as political staffers and community activists are eager to analyze this data as well, making it a great topic for taking R skills covered so far for a test drive. This chapter deals with planning for Election Day; creating an R script “recipe” for analysis; using base R’s save() and load() functions; generating interactive tables with a single line of code; calculating and visualization correlations; and creating quick interactive graphs with plotly and highcharter. With some pre-election planning, R can help journalist generate on-deadline charts, graphs, and analysis. It shows how a user might have prepared to cover the 2018 Massachusetts gubernatorial race and uses 2014 data to visualize results and create an interactive table. The chapter presents steps that will be fairly easy to adapt for upcoming contests.