liveBook · Manning

Map_df() function

As explained in Statistics Slam Dunk

The map_df() function from purrr applies a function over inputs and combines the resulting outputs into a data frame.

map_df() from purrr applies a function across the inputs and combines the results into a data frame. Here, it checks the classes of six NBA variables at once. section 9.3

Inspecting NBA variable classes

After filtering the NBA data to 7,191 games and six columns, run `map_df(mydata, class)`. The result is a one-row tibble showing character columns for locations and results, and integer columns for days off. Convert those variables to factors with `as.factor()` before grouping and tallying home and away wins.

How Statistics Slam Dunk covers it

How deep it goes
Demonstrates one practical class-inspection call but does not explain iteration or combination internals.
Examples
Uses six NBA game variables to inspect character and integer classes before converting them to factors.
What it assumes
Assumes a six-column data frame and tidyverse loading, while demonstrating class inspection before factor conversion.
What you can do after
Evaluate/understand column types together and prepare variables for subsequent categorical analysis.
How it connects
Connects purrr and tidyverse usage with data-frame classes, factors, and grouped tallying.

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.