sdTrim {trimr} | R Documentation |
RT trimming with standard deviation criterion
Description
sdTrim
takes a data frame of RT data and returns trimmed rt
data that fall below a set set criterion (based on standard deviations
above a particular mean). The criterion can be based on the mean of the
whole set of data, based on the mean per experimental condition, based on
the mean per participant, or based on the mean of each participant in each
experimental condition.
Usage
sdTrim(
data,
minRT,
sd,
pptVar = "participant",
condVar = "condition",
rtVar = "rt",
accVar = "accuracy",
perCondition = TRUE,
perParticipant = TRUE,
omitErrors = TRUE,
returnType = "mean",
digits = 3
)
Arguments
data |
A data frame with columns containing: participant identification number ('pptVar'); condition identification, if applicable ('condVar'); response time data ('rtVar'); and accuracy ('accVar'). The RT can be in seconds (e.g., 0.654) or milliseconds (e.g., 654). Typically, "condition" will consist of strings. Accuracy must be coded as 1 for correct and 0 for error responses. |
minRT |
The lower criteria for acceptable response time. Must be in the same form as rt column in data frame (e.g., in seconds OR milliseconds). All RTs below this value are removed before proceeding with SD trimming. |
sd |
The upper criteria for standard deviation cut-off. |
pptVar |
The quoted name of the column in the data that identifies participants. |
condVar |
The quoted name of the column in the data that includes the conditions. |
rtVar |
The quoted name of the column in the data containing reaction times. |
accVar |
The quoted name of the column in the data containing accuracy, coded as 0 or 1 for incorrect and correct trial, respectively. |
perCondition |
Set to TRUE if the user wishes the trimming to occur per condition of the experimental design. |
perParticipant |
Set to TRUE if the user wishes the trimming to occur per participant. |
omitErrors |
If set to TRUE, error trials will be removed before conducting trimming procedure. Final data returned will not be influenced by errors in this case. |
returnType |
Request nature of returned data. "raw" returns trial- level data excluding trimmed data; "mean" returns mean response times per participant for each experimental condition identified; "median" returns median response times per participant for each experimental condition identified. |
digits |
How many decimal places to round to after trimming? |
Details
By passing a data frame containing raw response time data, together with trimming criteria, the function will return trimmed data, either in the form of trial-level data or in the form of means/medians for each subject & condition.
Examples
# load the example data that ships with trimr
data(exampleData)
# perform the trimming with SD trimming per condition, returning mean RT
trimmedData <- sdTrim(data = exampleData, minRT = 150, sd = 2.5,
perCondition = TRUE, perParticipant = FALSE, returnType = "mean")