| textcleaner | R Documentation |
An automated cleaning function for spell-checking, de-pluralizing, removing duplicates, and binarizing text data
textcleaner(
data = NULL,
type = c("fluency", "free"),
miss = 99,
partBY = c("row", "col"),
dictionary = NULL,
spelling = c("UK", "US"),
add.path = NULL,
keepStrings = FALSE,
allowPunctuations,
allowNumbers = FALSE,
keepLength = NULL,
keepCue = FALSE,
keepRepeats = FALSE,
continue = NULL,
reader = readline,
search_fn = searcher::search_site,
cores = 1,
edit_fn = automated_edit
)
data |
Matrix or data frame. For
For
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type |
Character vector. Type of task to be preprocessed.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
miss |
Numeric or character.
Value for missing data.
Defaults to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
partBY |
Character.
Are participants by row or column?
Set to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dictionary |
Character vector.
The name(s) of the dictionary (or dictionaries) to spell-check against,
e.g., Use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
spelling |
Character vector. English spelling to be used.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
add.path |
Character.
Path to additional dictionaries to be found.
DOES NOT search recursively (through all folders in path)
to avoid time intensive search.
Set to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
keepStrings |
Boolean.
Should strings be retained or separated?
Defaults to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
allowPunctuations |
Character vector.
Allows punctuation characters to be included in responses.
Defaults to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
allowNumbers |
Boolean.
Defaults to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
keepLength |
Numeric.
Maximum number of words allowed in a response.
Defaults to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
keepCue |
Boolean.
Should cue words be retained in the responses?
Defaults to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
keepRepeats |
Boolean.
Should repeated responses (perseverations) within a participant be
retained in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
continue |
List.
A result previously unfinished that still needs to be completed.
Allows you to continue to manually spell-check your data
after you've exited early ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
reader |
Function.
The input reader used for every interactive prompt in the manual
spell-check wizard. Defaults to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
search_fn |
Function.
The function used to open a browser search for the "GOOGLE WORD"/
"GOOGLE STRING" manual spell-check options. Defaults to
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cores |
Numeric.
Number of computer cores to use in parallelized computations (the
"ad hoc" moniker re-check after manual spell-check). Defaults to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
edit_fn |
Function.
The spreadsheet-editor function used to review automated spell-check
changes. Defaults to |
Responses are cleaned before they are spell-checked: they are
lowercased, accented and typographic characters are transliterated to
ASCII ("caf\u00e9" becomes "cafe"), and characters with no
ASCII equivalent (e.g., Chinese or Cyrillic text) are removed, so a response
made only of such characters is treated as missing. The dictionaries
supplied by SemNetDictionaries are English.
A list of class "textcleaner". For type = "fluency":
responses |
A list of three matrices:
|
behavioral |
A data frame, one row per participant, with the number of
|
spellcheck |
A list of three matrices: |
moniker |
The |
dictionary, added_words |
Only present if words were added to the
dictionary and "In my results" was chosen when asked where to save them
(or a file could not be written). |
For type = "free", data holds the original and
clean long-format data, responses$clean is a response-by-cue
frequency matrix, and behavioral, spellcheck and the
dictionary objects are as above. If the manual spell-check is exited
early, the object instead holds the saved state and can be passed back
with continue =
Alexander Christensen <alexpaulchristensen@gmail.com>
Christensen, A. P., & Kenett, Y. N. (2021). Semantic network analysis (SemNA): A tutorial on preprocessing, estimating, and analyzing semantic networks. Psychological Methods. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/met0000463")}
Hornik, K., & Murdoch, D. (2010). Watch Your Spelling!. The R Journal, 3, 22-28.
if(interactive())
{
# Full example with the manual spell-check
clean <- textcleaner(open.animals[, -c(1, 2)], partBY = "row", dictionary = "animals")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.