liveBook · Manning

Square brackets

Also called bracket notation

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 →

Also covered in

What to know first

Related concepts

Questions about square brackets

What is square brackets?

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

Which Manning books explain square brackets?

Statistics Slam Dunk and Get Programming: Learn to code with Python.

What should I know before learning square brackets?

Manning books that teach square brackets usually introduce integer, list, string and atomic type first.

What is the difference between square brackets and dot notation?

Square brackets are paired punctuation marks used in programming-language syntax to delimit expressions or constructs, including indexing and collection literals. Dot notation uses periods to separate names in qualified or hierarchical references, commonly to access members or nested fields.

What is square brackets also called?

Square brackets is also called bracket notation.

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.