View source: R/psychReportData.R
summaryMSDSE | R Documentation |
Aggregate data returning the mean, standard deviation, and standard error
summaryMSDSE(data, factors, dvs, withinCorrection = NULL)
data |
A dataframe |
factors |
List of factors over which to aggregate |
dvs |
List of numeric data columns to aggregate |
withinCorrection |
List of dvs which to apply within-subjects correction to the calculation of the standard deviation and standard error. Within-subject correction calculated according to Morey (2008). NB Data should be normed first (see normData). |
dataframe
# Example 1: library(dplyr) dat <- createDF(nVP = 50, nTrl = 50, design = list("Comp" = c("comp", "incomp"))) dat <- addDataDF(dat, RT = list( "Comp comp" = c(500, 80, 100), "Comp incomp" = c(550, 80, 140) ), Error = list( "Comp comp" = 5, "Comp incomp" = 10 ) ) datAggVP <- dat %>% group_by(VP, Comp) %>% summarize( N = n(), RT = mean(RT[Error == 0]), ER = (sum(Error) / N) * 100 ) datAgg <- summaryMSDSE(datAggVP, "Comp", c("RT", "ER")) # Example 2: dat <- createDF(nVP = 50, nTrl = 50, design = list("Comp" = c("comp", "incomp"))) dat <- addDataDF(dat, RT = list( "Comp comp" = c(500, 80, 100), "Comp incomp" = c(550, 80, 140) ), Error = list( "Comp comp" = 5, "Comp incomp" = 10 ) ) datAggVP <- dat %>% group_by(VP, Comp) %>% summarize( N = n(), RT = mean(RT[Error == 0]), ER = (sum(Error) / N) * 100 ) datAggVP <- normData(datAggVP, "VP", c("RT", "ER")) datAgg <- summaryMSDSE( datAggVP, "Comp", c("RT", "ER", "RT_norm", "ER_norm"), c("RT_norm", "ER_norm") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.