col_subset: Keep columns whose names match a pattern

View source: R/col_subset.R

col_subsetR Documentation

Keep columns whose names match a pattern

Description

col_subset() is a wrapper around m[, str_detect(colnames(m), pattern)]

Usage

col_subset(m, pattern, negate = FALSE)

Arguments

m

Input matrix or data frame.

pattern

Pattern to look for. The default interpretation is a regular expression, as described in stringi::stringi-search-regex. Control options with 'regex()'.

negate

If 'TRUE', return non-matching columns.

Details

Vectorised over colnames('m') and 'pattern'

Value

A matrix.


jlaffy/scalop documentation built on March 24, 2024, 9 a.m.