qprep: Quick Preparation of Text

Description Usage Arguments Note See Also Examples

View source: R/qprep.R

Description

Wrapper for bracketX, replace_number, replace_symbol, replace_abbreviation and scrubber to quickly prepare text for analysis. Care should be taken with this function to ensure data is properly formatted and complete.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
qprep(
  text.var,
  rm.dash = TRUE,
  bracket = "all",
  missing = NULL,
  names = FALSE,
  abbreviation = qdapDictionaries::abbreviations,
  replace = NULL,
  ignore.case = TRUE,
  num.paste = TRUE,
  ...
)

Arguments

text.var

The text variable.

rm.dash

logical. If TRUE dashes will be removed.

bracket

The type of bracket (and encased text) to remove. This is one of the strings "curly", "square", "round", "angle" and "all". These strings correspond to: {, [, (, < or all four types. Also takes the argument NULL which turns off this parsing technique.

missing

Value to assign to empty cells.

names

logical. If TRUE the sentences are given as the names of the counts.

abbreviation

A two column key of abbreviations (column 1) and long form replacements (column 2) or a vector of abbreviations. Default is to use qdap's abbreviations data set. Also takes the argument NULL which turns off this parsing technique.

replace

A vector of long form replacements if a data frame is not supplied to the abbreviation argument.

ignore.case

logical. If TRUE replaces without regard to capitalization.

num.paste

logical. If TURE a the elements of larger numbers are separated with spaces. If FALSE the elements will be joined without spaces. Also takes the argument NULL which turns off this parsing technique.

...

Other arguments passed to replace_symbol.

Note

Care should be taken with this function to ensure data is properly formatted and complete.

See Also

bracketX, replace_abbreviation, replace_number, replace_symbol

Examples

1
2
3
4
5
## Not run: 
x <- "I like 60 (laughter) #d-bot and $6 @ the store w/o 8p.m."
qprep(x)

## End(Not run)

trinker/qdap documentation built on Sept. 30, 2020, 6:28 p.m.