idiosync_participant_words: Idiosyncratic Participant Words

Description Usage Arguments Details Value See Also Examples

View source: R/idiosync.R

Description

This function identifies participants' words that are idiosyncratic (i.e. used multiple times by a single participant, and never by any other participant). It can also be used to remove these words.

Usage

1
2
3
4
5
6
idiosync_participant_words(
  inputDataframe,
  mode,
  textColumnName,
  participantColumnName
)

Arguments

inputDataframe

A dataframe containing a column with text data (character strings) and participant IDs

mode

This defines the mode of operation. Options include "output", "remove", or "both". See Details below.

textColumnName

A string consisting of the name of the column in inputDataframe which contains text data

participantColumnName

A string consisting of the name of the column in inputDataframe which contains participant IDs

Details

This function has three modes: In the "output" mode, a dataframe is produced with three columns: the participant who produced the idiosyncratic words, the words, and how frequently they are used by the participant. In the "remove" mode, a character string (or vector of character strings) is produced, where all of the idiosyncratic words are removed. In the "both" mode, both of the above results will be produced (i.e. a list containing a dataframe of idiosyncratic words, as well as the text with those words removed)

Value

A dataframe (mode="output"), a character string or vector of character strings (mode="remove"), or a two-object list containing both results (mode="both")

See Also

idiosync_response_words

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
myStrings = c("Last week while I was walking in the park, I saw a firetruck go by. It was red.",
              "My dog loves to go on walks in the park every day of the week.",
              "Where I live, it snows all winter long. It's so cold outside.",
              "My kids love to play in the snow. They love to collect snow to build snowmen.",
              "When I was younger, I used to visit my grandmother every week.",
              "In the summertime, we would get together with my grandmother to bake cookies.")
mydataframe = data.frame(text=myStrings, participant=c(1,1,2,2,3,3), stringsAsFactors = FALSE)
idiosync_output = idiosync_participant_words(mydataframe, "output", "text", "participant")
idiosync_output
# participant     feature       frequency
# 1                park          2
# 1                go            2
# 2                love          2
# 2                snow          2
# 3                grandmother   2

idiosync_removed = idiosync_participant_words(mydataframe, "remove", "text", "participant")
idiosync_removed
# "Last week while I was walking in the, I saw a firetruck by. It was red."
# "My dog loves to on walks in the every day of the week."
# "Where I live, it snows all winter long. It's so cold outside."
# "My kids to play in the. They to collect to build snowmen."
# "When I was younger, I used to visit my every week."
# "In the summertime, we would get together with my to bake cookies."

nlanderson9/languagePredictR documentation built on June 10, 2021, 11 a.m.