qdap (version 2.2.4)

strip: Strip Text

Description

Strip text of unwanted characters. strip.character - factor method for strip. strip.factor - factor method for strip. strip.default - factor method for strip. strip.list - factor method for strip.

Usage

strip(x, char.keep = "~~", digit.remove = TRUE, apostrophe.remove = TRUE,
  lower.case = TRUE)

## S3 method for class 'character':
strip(x, char.keep = "~~", digit.remove = TRUE,
  apostrophe.remove = TRUE, lower.case = TRUE)

## S3 method for class 'factor':
strip(x, char.keep = "~~", digit.remove = TRUE,
  apostrophe.remove = TRUE, lower.case = TRUE)

## S3 method for class 'default':
strip(x, char.keep = "~~", digit.remove = TRUE,
  apostrophe.remove = TRUE, lower.case = TRUE)

## S3 method for class 'list':
strip(x, char.keep = "~~", digit.remove = TRUE,
  apostrophe.remove = TRUE, lower.case = TRUE)

Arguments

x
The text variable.
char.keep
A character vector of symbols (i.e., punctuation) that strip should keep. The default is to strip every symbol except apostrophes and a double tilde "~~". The double tilde "~~"
digit.remove
logical. If TRUE strips digits from the text.
apostrophe.remove
logical. If TRUE removes apostrophes from the output.
lower.case
logical. If TRUE forces all alpha characters to lower case.

Value

  • Returns a vector of text that has been stripped of unwanted characters.

See Also

rm_stopwords

Examples

Run this code
DATA$state #no strip applied
strip(DATA$state)
strip(DATA$state, apostrophe.remove=FALSE)
strip(DATA$state, char.keep = c("?", "."))

Run the code above in your browser using DataLab