Selecting multiple elements with [
Special way of subsetting for data frames: df[rows, cols]
.
Here, rows
and cols
are vectors (indices, logical, names) to subset the data frame.
Column selection: cf. select()
, relocate()
## x y z
## 1 1 k FALSE
## 2 2 l TRUE
## x y
## 1 1 k
## z y
## 1 FALSE k
## 2 TRUE l