Cover -- Half Title -- Chapman & Hall/CRCThe R Series -- Title -- Copyright -- Dedication -- Contents -- Companion Web site -- Chapter 1 Introduction -- 1.1 Why programming? -- 1.2 Why R? -- 1.3 Is this book for you? -- Chapter 2 Get Started With R in a Few Easy Steps -- 2.1 What we’ll cover -- 2.2 Download R and RStudio -- 2.3 A brief introduction to RStudio -- 2.4 Try out the console -- 2.5 Install packages -- 2.6 Additional infrastructure -- 2.7 Getting help with packages and functions -- 2.8 RStudio keyboard shortcuts -- 2.9 Additional files available online -- 2.10 Wrap-Up -- 2.11 Additional resources -- Chapter 3 See How Much You Can Do in a Few Lines of Code -- 3.1 Packages needed in this chapter -- 3.2 What we’ll cover -- 3.3 Simple stock market graphing -- 3.4 Download and graph a city’s median income -- 3.5 So many packages! -- 3.6 Running functions without loading packages -- 3.7 Comparing one city’s data to the US median -- 3.8 Run a remote script to make an interactive map -- 3.9 Bonus map: Mapping income data -- 3.10 Wrap-Up -- 3.11 Additional resources -- Chapter 4 Import Data into R -- 4.1 What we’ll cover -- 4.2 Packages needed in this chapter -- 4.3 The magic of rio -- 4.4 Import data from packages -- 4.5 What’s a data frame? And what can you do with one? -- 4.6 Easy sample data -- 4.7 Exporting data -- 4.8 Additional resources -- Chapter 5 Basic Data Exploration -- 5.1 Project: Weather data -- 5.2 What we’ll cover -- 5.3 Packages needed in this chapter -- 5.4 Download this book’s files -- 5.5 Data summaries -- 5.6 Data ‘interviews’ -- 5.7 Slicing and dicing your data set -- 5.8 More subsetting with dplyr -- 5.9 Wrap-Up -- 5.10 Additional resources -- Chapter 6 Beginning data visualization -- 6.1 Project: More weather data -- 6.2 What we’ll cover: How to -- 6.3 Packages needed in this chapter -- 6.4 Answer questions with graphics -- 6.5 Easy visualizations in 1 or 2 lines of code -- 6.6 Some basic graphs -- 6.7 The full power of ggplot2 -- 6.8 Basic ggplot2 customizations -- 6.9 Code snippets to the rescue -- 6.10 Presentation-quality graphics -- 6.11 Comment your code -- 6.12 Wrap-up -- 6.13 Additional resources -- Chapter 7 Two or more data sets -- 7.1 Project: Multiple files of U.S. airline on-time data -- 7.2 What we’ll cover -- 7.3 Packages needed in this chapter -- 7.4 Add one table to the bottom of another -- 7.5 What’s a list, and how do you operate on one? -- 7.6 lapply -- 7.7 here() you are! -- 7.8 Wrap-up -- 7.9 Exercise 1 Answer -- 7.10 Additional resources -- Chapter 8 Analyze data by groups -- 8.1 Project: Airline on-time data analysis (cont.) -- 8.2 What we’ll cover -- 8.3 Packages needed in this chapter -- 8.4 Lookup tables -- 8.5 Beware of missing values -- 8.6 Bar graph of raw data -- 8.7 Wrap up -- 8.8 Additional resources -- Chapter 9 Graphing by Group -- 9.1 Project: Visualizing airline on-time data -- 9.2 What we’ll cover -- 9.3 Packages needed in this chapter -- 9.4 Facets -- 9.5 Housing prices by state --.
9.6 Geofacets -- 9.7 Customizing colors -- 9.8 Color palettes -- 9.9 Other packages that extend ggplot2 functionality -- 9.10 Wrap-up -- 9.11 Additional Resources -- 9.12 Exercise 2 answer -- Chapter 10 Write your own R functions -- 10.1 What we’ll cover -- 10.2 Packages needed in this chapter -- 10.3 Function basics -- 10.4 seq() -- 10.5 If-then-else -- 10.6 if statements for vectors -- 10.7 A taste of testing -- 10.8 Next steps for your functions -- 10.9 More Resources -- 10.10 Exercise 3 Answer -- 10.11 Exercise 4 Answer -- 10.12 Exercise 5 -- Chapter 11 Maps in R -- 11.1 Map projects in this chapter -- 11.2 Skills we’ll cover -- 11.3 Importing shape files into R -- 11.4 Import data for mapping -- 11.5 An even easier way to pull U.S. Census data -- 11.6 Interactive maps with tmap -- 11.7 Importing and joining data -- 11.8 Leaflet and points on a map -- 11.9 geocoding and R’s paste() function -- 11.10 Time to geocode with R (or maybe without) -- 11.11 Mapping points with leaflet -- 11.12 Points and polygons on a single map -- 11.13 Mapping new political boundaries with leaflet -- 11.14 Inspiration: Washington Post investigation -- 11.15 Wrap-up -- 11.16 Additional resources -- Chapter 12 Putting it all Together: R on Election Day -- 12.1 Project: Election data -- 12.2 What we’ll cover -- 12.3 Packages needed in this chapter -- 12.4 Election Day preparation -- 12.5 Visualizing election results -- 12.6 Graph for a smaller set of results -- 12.7 plotly -- 12.8 Other interactive alternatives -- 12.9 Wrap-up -- 12.10 (Non-election) inspiration -- 12.11 Additional resources -- Chapter 13 Date calculations -- 13.1 Project: New York City restaurant inspections -- 13.2 What we’ll cover -- 13.3 Packages needed in this chapter -- 13.4 Get started with dates in R -- 13.5 Get NYC inspection data -- 13.6 Wrap-up -- 13.7 Inspiration -- 13.8 Additional resources -- Chapter 14 Help! My data’s in the wrong format! -- 14.1 Project: Election results in a PDF -- 14.2 What we’ll cover -- 14.3 Packages needed in this chapter -- 14.4 Human vs. machine optimizing -- 14.5 The raw data -- 14.6 Extracting data from PDFs -- 14.7 Tidying the data -- 14.8 Reshaping the data -- 14.9 ‘Long’ data back to ‘wide’ -- 14.10 Winners and runners-up -- 14.11 Wrap-up -- 14.12 Additional resources -- 14.13 Using tabulizer to unlock the City Council data -- Chapter 15 Integrate R With Your Storytelling Using R Markdown -- Project: Mixing text and R code about that snow data -- 15.1 What we’ll cover -- 15.2 Packages needed in this chapter -- 15.3 R Markdown basics -- 15.4 Create an R Markdown document -- 15.5 R Markdown text syntax -- 15.6 R code chunks -- 15.7 Adding R code to run -- 15.8 Add an R-generated graph -- 15.9 Setting options -- 15.10 Mixing R within text -- 15.11 Even more options -- 15.12 Repeatability with R Markdown parameters -- 15.13 Wrap-up -- 15.14 Additional resources -- Chapter 16 Simple Web scraping -- 16.1 Project: Download RStudio PDF cheat sheets -- 16.2 What we.
’ll cover -- 16.3 Packages needed in this chapter -- 16.4 Step 1: Follow the rules with robotstxt -- 16.5 Step 2: Get a list of links -- 16.6 Step 3: Download files -- 16.7 Wrap-Up -- 16.8 Additional resources -- Chapter 17 An R project from start to finish -- 17.1 Project: Local political contribution and election data -- 17.2 What we’ll cover -- 17.3 Packages needed in this chapter -- 17.4 Get the data, make it ready for analysis -- 17.5 Standardizing multiple versions of the same name -- 17.6 Making 2 data frames 1 -- 17.7 Analyzing and graphing the results -- 17.8 Visualizing results -- 17.9 Consider R Markdown -- 17.10 Additional resources -- Chapter 18 Additional resources -- 18.1 More functions, packages and tools worth a look -- 18.2 Stories done with R -- 18.3 Tutorials -- 18.4 Social media, communities, and Web resources -- Appendix A Online: How do I -- Appendix B Online: Functions -- Appendix C Online: Packages -- Index -- .