remove_from: Remove all columns or rows from 'data.frame' matching...

Description Usage Arguments Value Author(s) See Also Examples

Description

Remove all columns or rows from data.frame matching criterion

Usage

1
2
3
4
5
remove_from(DF, fun, dim = c("both", "rows", "cols"))

remove_from_rows(DF, fun)

remove_from_cols(DF, fun)

Arguments

DF

data.frame or matrix

fun

function with criterion for removal

Value

data.frame or matrix with matching removed

Author(s)

Thomas P. Harte

See Also

grep, match

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
FUN<- function(x) is_blank(x) | is.na(x)

tab<- read.table(con<- textConnection(
"Name  Age Salary
 Dick   NA    32k
 Tom    NA    21k
 NA     NA    NA"
), header=TRUE, colClasses=c("character","integer","character")); close(con)


 remove_from_rows(tab, fun=FUN)
 remove_from(tab, fun=FUN, dim="row")

 remove_from_cols(tab, fun=FUN)
 remove_from(tab, fun=FUN, dim="col")

 remove_from(tab, fun=FUN, dim="both")

tharte/tutils documentation built on Feb. 11, 2020, 9:17 a.m.