R Indexing Explorer

Select rows, columns, and cells three different ways

data: palmerpenguins::penguins n = 15 rows shown
Indexing Method
Which column?
The $ operator always returns all rows as a vector.
Data Table
# species island bill_length_mm flipper_length_mm body_mass_g sex
R Code
$ operator
[ , ] brackets
Boolean filter
Here's how this works.

The code panel above shows real R code you can paste into R. The colored stripe on the left of each line marks which indexing concept it belongs to: blue for $, green for [ , ], amber for Boolean subsetting.

The data table in the middle highlights exactly what gets selected: which rows, which columns, or which cells. Use the controls on the left to change the method and options. The code, the table, and this explanation all update instantly each time you click something.