Programming Skills for Data Science: Start Writing Code to Wrangle, Analyze, and Visualize Data with R, 1st edition

Published by Addison-Wesley Professional (November 23, 2018) © 2019

  • Michael Freeman
  • Joel Ross
Products list
  • Available for purchase from all major ebook resellers, including InformIT.com
Products list

Details

  • A print text
  • Free shipping
  • Also available for purchase as an ebook from all major ebook resellers, including InformIT.com

Leading instructors Michael Freeman and Joel Ross guide readers through installing and configuring the tools needed to solve professional-level data science problems, including the widely used R language and Git version-control system. They explain how to wrangle data into a form where it can be easily used, analyzed, and visualized so others can see the patterns you’ve uncovered. Step by step, students will master powerful R programming techniques and troubleshooting skills for probing data in new ways, and at larger scales.

Freeman and Ross teach through practical examples and exercises that can be combined into complete data science projects. Everything’s focused on real-world application, so students can quickly start analyzing their own data and getting answers they can act upon.

Foreword xi

Preface xiii

Acknowledgments xvii

About the Authors xix

 

Part I: Getting Started 1

 

Chapter 1: Setting Up Your Computer 3

1.1 Setting up Command Line Tools 4

1.2 Installing git 5

1.3 Creating a GitHub Account 6

1.4 Selecting a Text Editor 6

1.5 Downloading the R Language 7

1.6 Downloading RStudio 8

 

Chapter 2: Using the Command Line 9

2.1 Accessing the Command Line 9

2.2 Navigating the File System 11

2.3 Managing Files 15

2.4 Dealing with Errors 18

2.5 Directing Output 20

2.6 Networking Commands 20

 

Part II: Managing Projects 25


Chapter 3: Version Control with git and GitHub 27

3.1 What Is git? 27

3.2 Configuration and Project Setup 30

3.3 Tracking Project Changes 32

3.4 Storing Projects on GitHub 36

3.5 Accessing Project History 40

3.6 Ignoring Files from a Project 42

 

Chapter 4: Using Markdown for Documentation 45

4.1 Writing Markdown 45

4.2 Rendering Markdown 48

 

Part III: Foundational R Skills 51


Chapter 5: Introduction to R 53

5.1 Programming with R 53

5.2 Running R Code 54

5.3 Including Comments 58

5.4 Defining Variables 58

5.5 Getting Help 63

 

Chapter 6: Functions 69

6.1 What Is a Function? 69

6.2 Built-in R Functions 71

6.3 Loading Functions 73

6.4 Writing Functions 75

6.5 Using Conditional Statements 79

 

Chapter 7: Vectors 81

7.1 What Is a Vector? 81

7.2 Vectorized Operations 83

7.3 Vector Indices 88

7.4 Vector Filtering 90

7.5 Modifying Vectors 92

 

Chapter 8: Lists 95

8.1 What Is a List? 95

8.2 Creating Lists 96

8.3 Accessing List Elements 97

8.4 Modifying Lists 100

8.5 Applying Functions to Lists with lapply() 102

 

Part IV: Data Wrangling 105


Chapter 9: Understanding Data 107

9.1 The Data Generation Process 107

9.2 Finding Data 108

9.3 Types of Data 110

9.4 Interpreting Data 112

9.5 Using Data to Answer Questions 116

Chapter 10: Data Frames 119

10.1 What Is a Data Frame? 119

10.2 Working with Data Frames 120

10.3 Working with CSV Data 124

 

Chapter 11: Manipulating Data with dplyr 131

11.1 A Grammar of Data Manipulation 131

11.2 Core dplyr Functions 132

11.3 Performing Sequential Operations 139

11.4 Analyzing Data Frames by Group 142

11.5 Joining Data Frames Together 144

11.6 dplyr in Action: Analyzing Flight Data 148

 

Chapter 12: Reshaping Data with tidyr 155

12.1 What Is “Tidy” Data? 155

12.2 From Columns to Rows: gather() 157

12.3 From Rows to Columns: spread() 158

12.4 tidyr in Action: Exploring Educational Statistics 160

 

Chapter 13: Accessing Databases 167

13.1 An Overview of Relational Databases 167

13.2 A Taste of SQL 171

13.3 Accessing a Database from R 175

 

Chapter 14: Accessing Web APIs 181

14.1 What Is a Web API? 181

14.2 RESTful Requests 182

14.3 Accessing Web APIs from R 189

14.4 Processing JSON Data 191

14.5 APIs in Action: Finding Cuban Food in Seattle 197

 

Part V: Data Visualization 205


Chapter 15: Designing Data Visualizations 207

15.1 The Purpose of Visualization 207

15.2 Selecting Visual Layouts 209

15.3 Choosing Effective Graphical Encodings 220

15.4 Expressive Data Displays 227

15.5 Enhancing Aesthetics 229

 

Chapter 16: Creating Visualizations with ggplot2 231

16.1 A Grammar of Graphics 231

16.2 Basic Plotting with ggplot2 232

16.3 Complex Layouts and Customization 238

16.4 Building Maps 248

16.5 ggplot2 in Action: Mapping Evictions in San Francisco 252

 

Chapter 17: Interactive Visualization in R 257

17.1 The plotly Package 258

17.2 The rbokeh Package 261

17.3 The leaflet Package 263

17.4 Interactive Visualization in Action: Exploring Changes to the City of Seattle 266

 

Part VI: Building and Sharing Applications 273


Chapter 18: Dynamic Reports with R Markdown 275

18.1 Setting Up a Report 275

18.2 Integrating Markdown and R Code 279

18.3 Rendering Data and Visualizations in Reports 281

18.4 Sharing Reports as Websites 284

18.5 R Markdown in Action: Reporting on Life Expectancy 287

 

Chapter 19: Building Interactive Web Applications with Shiny 293

19.1 The Shiny Framework 293

19.2 Designing User Interfaces 299

19.3 Developing Application Servers 306

19.4 Publishing Shiny Apps 309

19.5 Shiny in Action: Visualizing Fatal Police Shootings 311

 

Chapter 20: Working Collaboratively 319

20.1 Tracking Different Versions of Code with Branches 319

20.2 Developing Projects Using Feature Branches 329

20.3 Collaboration Using the Centralized Work[1]ow 331

20.4 Collaboration Using the Forking Work[1]ow 335

 

Chapter 21: Moving Forward 341

21.1 Statistical Learning 341

21.2 Other Programming Languages 342

21.3 Ethical Responsibilities 343

 

Index 345

Need help? Get in touch