filter_row: Remove Rows That Contain Markers

Description Usage Arguments Value Examples

View source: R/filter_row.R

Description

filter_row - Remove rows from a data set that contain a given marker/term.

filter_empty_row - Removes the empty rows of a data set that are common in reading in data.

filter_NA - Removes the NA rows of a data set.

Usage

1
2
3
4
5
filter_row(dataframe, column, terms, ...)

filter_empty_row(dataframe)

filter_NA(dataframe, column = TRUE, ...)

Arguments

dataframe

A dataframe object.

column

Column name to search for markers/terms.

terms

The regex terms/markers of the rows that are to be removed from the dataframe.

...

Other arguments passed to grepl.

Value

filter_row - returns a dataframe with the termed/markered rows removed.

filter_empty_row - returns a dataframe with empty rows removed.

filter_NA - returns a dataframe with NA rows removed.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
## filter_row EXAMPLE:
filter_row(DATA, "person", c("sam", "greg"))
filter_row(DATA, 1, c("sam", "greg"))
filter_row(DATA, "state", c("Comp"))
filter_row(DATA, "state", c("I "))
filter_row(DATA, "state", c("you"), ignore.case=TRUE)

## filter_empty_row EXAMPLE:
(dat <- rbind.data.frame(DATA[, c(1, 4)], matrix(rep(" ", 4), 
   ncol =2, dimnames=list(12:13, colnames(DATA)[c(1, 4)]))))
filter_empty_row(dat)

## filter_NA EXAMPLE:
DATA[1:3, "state"] <- NA
filter_NA(DATA)

## End(Not run)

textclean documentation built on May 2, 2019, 7:22 a.m.