liveBook · Manning

Square brackets

Square brackets are paired punctuation marks used in programming-language syntax to delimit expressions or constructs, including indexing and collection literals.

How 2 Manning books explain it

Statistics Slam Dunk

An extraction operator is syntax that selects a subset of elements from an R vector, matrix, array, list, or data frame.

How it is used
Uses indexing to select data-frame columns for calculations and replace invalid vector values before analysis.
How deep it goes
Defines extraction operators and demonstrates positional selection, conditional selection, indexed assignment, and validation.
Examples
Demonstrates selecting salary and win columns, calculating team summaries, and replacing 227 negative win-share records.
What you can do after
Diagnose and correct selected R values while extracting columns for practical NBA data summaries.

Read how Statistics Slam Dunk explains square brackets →

Get Programming: Learn to code with Python

Square bracket notation is Python syntax that places an index or slice specification inside brackets to access part of a sequence.

How it is used
Accesses elements in lists and characters or substrings in strings.
How deep it goes
Defines indexing, negative positions, slicing syntax, and out-of-range errors through short examples and checks.
Examples
Uses grocery lists, “Python rules!”, student records, character indexes, and quick-check expressions.
What you can do after
Apply it in Python to create lists, retrieve sequence items, slice strings, and recognize invalid list indexes.

Read how Get Programming: Learn to code with Python explains square brackets →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.