filter_row {textclean}R Documentation

Remove Rows That Contain Markers

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

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

## 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)

[Package textclean version 0.9.3 Index]