subset_: Inspect a Subset of data.frame

View source: R/subset_.R

subset_R Documentation

Inspect a Subset of data.frame

Description

..

Usage

subset_(x, subset, select, select_pattern, avoid, avoid_pattern)

Arguments

x

a data.frame

subset

logical expression, see function subset.data.frame

select

character vector, columns to be selected, see function subset.data.frame

select_pattern

regular expression regex for multiple columns to be selected

avoid

character vector, columns to be avoided

avoid_pattern

regular expression regex, for multiple columns to be avoided

Details

Function subset_ is different from subset.data.frame, such that

  • if both select and select_pattern are missing, only variables mentioned in subset are selected;

  • be able to select all variables, except those in avoid and avoid_pattern;

  • always returns data.frame, i.e., forces drop = FALSE

Value

Function subset_ returns a data.frame, with additional attributes

attr(,'vline')

integer scalar, position of a vertical line (see ?flextable::vline)

⁠attr(,'jhighlight)'⁠

character vector, names of columns to be flextable::highlighted.

Examples

subset_(trees, Girth > 9 & Height < 70)
subset_(swiss, Fertility > 80, avoid = 'Catholic')
subset_(warpbreaks, wool == 'K')


ThomasJeffersonUniv documentation built on July 3, 2024, 5:08 p.m.