liveBook · Manning

Dataset

As explained in Statistics Slam Dunk

A dataset is a collection of structured observations and variables representing recorded information for analysis.

A dataset is a collection of recorded observations arranged as variables and records for analysis. It may arrive as a CSV file or spreadsheet, and its dimensions describe its rows and columns. Real datasets rarely arrive ready for the question at hand: they can include irrelevant fields, unwanted records, or variables that must be created or converted. section 13.2 section 17.2

Treat preparation as part of the analysis, not a preliminary nuisance. Import the data, inspect its size and variables, then reduce it to the records and columns needed. Filtering, selecting, renaming, changing variable classes, reshaping, and joining can turn a broad raw dataset into an object suited to visualization or statistical testing. section 2.7 section 16.2

Useful questions to ask of any dataset include:

  • What does one record represent? A player-season-team dataset can assign one unique record to each player/year/team combination. section 13.2
  • Which variables answer the analytical question, and which can be removed? Reducing width keeps queries faster and attention focused. section 13.2
  • Which observations belong in scope? Filter by season, venue, event type, team, or other logical criteria before computing results. section 7.3 section 19.2
  • Do related datasets need to be combined? Separate road and home records can be aligned into one dataset for comparison. section 7.3

From game logs to a focused comparison

To compare high-performing teams by quarter, start with game data, filter to six road teams, retain relevant quarter outcomes, count the outcome categories, and calculate percentages. A small new data frame can then hold one percentage per quarter for a bar chart. The transformed dataset makes the comparison visible without claiming that the original raw layout was already fit for it. section 6.4.5

nbadf3 %>% 
 filter(teamR == "Milwaukee" | teamR == "Toronto" | 
          teamR == "Boston" | teamR == "Denver" | 
          teamR == "Houston" | teamR == "LA Clippers") -> nbadf7

nbadf7 %>%
 filter(Q1vF == "RR" | Q1vF == "RH") -> nbadf8

This filter creates a focused dataset by retaining observations for six named road teams before later analysis. section 6.4.5

How Statistics Slam Dunk covers it

How deep it goes
Explains importing, dimensions, records, variables, and extensive wrangling, while deferring dataset design and collection methods.
Examples
Uses NBA player-season statistics, franchise histories, box scores, game logs, and play-by-play records.
What it assumes
Teaches dataset inspection and wrangling from imported files without assuming advanced R or statistics knowledge.
What you can do after
Apply it via R by importing, inspecting, filtering, selecting, converting, reshaping, joining, and summarizing datasets for analysis.
How it connects
Connects datasets to data wrangling, data visualization, statistical testing, predictive models, variables, observations, and data types.

Also explained in

Compare how 24 books explain dataset →

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.