liveBook · Manning

Logical type

As explained in Statistics Slam Dunk

A logical data type represents Boolean values such as TRUE, FALSE, and missing values in R.

A logical data type stores Boolean values such as TRUE and FALSE. In an NBA results table, logical columns record whether each team won a quarter or the game. section 6.4.6

Use logical columns to represent and transform result conditions:

  • Convert logical values with as.numeric(), changing FALSE to 0 and TRUE to 1 for counting and reshaping. section 6.4.6

Counting halftime-tied game outcomes

Six logical result combinations become numeric counts: HHH occurs 18 times, RRR 13 times, and HRR 6 times. The combinations describe who won the third quarter, fourth quarter, and game.

How Statistics Slam Dunk covers it

How deep it goes
Explains TRUE/FALSE inspection and conversion to 0/1, then applies the values in counting and reshaping operations.
Examples
Uses quarter-winning conditions, six-letter result codes, and a summary table of halftime-tied NBA games.
What you can do after
Apply logical columns in R to create indicators, count result combinations, and reshape Boolean results into a long table.
How it connects
Connects logical values with dplyr grouping and selection, base R indexing and conversion, and tidyr reshaping.

Also explained in

Compare how 2 books explain logical type →

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.