drop_row {textclean} | R Documentation |
Filter Rows That Contain Markers
Description
drop_row
- Remove rows from a data set that contain a given
marker/term.
keep_row
- Keep rows from a data set that contain a given marker/term.
drop_empty_row
- Removes the empty rows of a data set that are common in
reading in data.
drop_NA
- Removes the NA
rows of a data set.
Usage
drop_row(dataframe, column, terms, ...)
keep_row(dataframe, column, terms, ...)
drop_empty_row(dataframe)
drop_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 |
Value
drop_row
- returns a dataframe with the termed/markered rows
removed.
drop_empty_row
- returns a dataframe with empty rows removed.
drop_NA
- returns a dataframe with NA
rows removed.
Examples
## Not run:
## drop_row EXAMPLE:
drop_row(DATA, "person", c("sam", "greg"))
keep_row(DATA, "person", c("sam", "greg"))
drop_row(DATA, 1, c("sam", "greg"))
drop_row(DATA, "state", c("Comp"))
drop_row(DATA, "state", c("I "))
drop_row(DATA, "state", c("you"), ignore.case=TRUE)
## drop_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)]))))
drop_empty_row(dat)
## drop_NA EXAMPLE:
DATA[1:3, "state"] <- NA
drop_NA(DATA)
## End(Not run)
[Package textclean version 0.9.3 Index]