Skip to contents

Retain only the `n` columns, the first let apart.

Usage

retain(x, n_col = ncol(x) - 1)

Arguments

x

data.frame with first column as grouping column

n_col

integer number of columns to retain. All by default.

Value

data.frame

Examples

# untouched dataset with all its columns
ncol(pig)
#> [1] 51
# after retaining only 12 (plus the 1st as the grouping)
ncol(retain(pig, 12))
#> [1] 13