removeCols: Remove columns from a data frame

Description Usage Arguments Value Examples

View source: R/miscUtils.R

Description

Use regexp matching to remove columns from a data frame

Usage

1
removeCols(df, match_string)

Arguments

df

is a data frame

match_string

is a string for grepl matching

Value

.df with columns matched by .match_string removed

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
> test <- data.frame(x = c(1,2,3),
                     y = c(4,5,6),
                     xa = c(7,8,9),
                     apple = c(5,5,5))
> removeCols(test, "x")
  y apple
1 4     5
2 5     5
3 6     5
> removeCols(test, "x|a")
  y
1 4
2 5
3 6

kikapp/kikapputils documentation built on May 24, 2021, 10:41 p.m.