drop.columns: Drop (or keep) all columns containing a vector of strings

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/drop.columns.R

Description

Drop (or keep) all columns containing a vector of strings

Usage

1
drop.columns(string, data, drop = TRUE)

Arguments

string

The string (or vector of strings) to be kept or omitted.

data

The dataset

drop

Logical. Should the columns containing string be dropped?

Value

a dataset with the column(s) dropped or kepts

Author(s)

Dustin Fife

References

http://stackoverflow.com/questions/7597559/grep-in-r-with-a-list-of-patterns

See Also

make.null

Examples

1
2
3
4
5
6
7
8
### drop all columns with the words "Length"
data(iris)
iris.dropped = drop.columns("Length", data=iris, drop=TRUE)

### keep only those columns with HemoLeptin in the string
data(fakeMedicalData)
medical = drop.columns("HemoLeptin", data=fakeMedicalData, drop=FALSE)
head(medical)

dustinfife/fifer documentation built on Oct. 31, 2020, 3:36 p.m.