liveBook · Manning

Readr

As explained in Statistics Slam Dunk

readr is an R package for efficiently importing and parsing rectangular data files.

readr is an R package for efficiently importing rectangular data files, especially comma-separated values (CSV) files. The read_csv() function reads a CSV into an R data set, typically a tibble, so it can be inspected, wrangled, visualized, and analyzed. section 1.3 section 3.3

A practical readr workflow is:

  • Install readr if necessary, then load it directly or load the wider tidyverse with library(tidyverse). section 1.3 section 19.1
  • Import a CSV by assigning read_csv("file.csv") to a meaningful object name. section 4.3 section 15.2
  • Inspect the result with glimpse() for a compact transposed view, or combine dim() with head() and tail() for dimensions and raw-row previews. section 3.3
  • Continue with wrangling, exploratory analysis, visualization, or statistical modeling after checking the imported structure and contents. section 1.3

Importing NBA draft data

draft2 <- read_csv("draft2.csv") glimpse(draft2) # Rows: 291 # Columns: 18 The imported data contains 291 rows and 18 columns, including player, team, position, age, and career variables. Because the file was prepared earlier, the import avoids repeating its previous wrangling. section 3.3

Figure 1.5 A typical chapter flow and, not coincidentally, the typical end-to-end flow of most real-world data science and statistics projects
CH01_F05_Sutton

Follow the end-to-end flow from importing data through preparation, exploration, analysis, and interpretation. section 1.3

How Statistics Slam Dunk covers it

How deep it goes
Demonstrates read_csv() assignment and post-import inspection with glimpse(), dim(), head(), and tail(), but not parser configuration.
Examples
Uses NBA draft, free-agent, and franchise-history CSV files, then previews imported structures and dimensions.
What it assumes
Assumes basic R assignment and function calls while teaching package loading, CSV import, and first-look data inspection.
What you can do after
Operate/configure read_csv() to import CSV data and inspect its rows, columns, variables, and initial contents.
How it connects
Connects readr with tidyverse, dplyr, tidyr, ggplot2, data wrangling, and exploratory data analysis.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Slam Dunk. The section links point to the parts of the book it draws on.