summaryMSDSE: summaryMSDSE

Description Usage Arguments Value Examples

View source: R/psychReportData.R

Description

Aggregate data returning the mean, standard deviation, and standard error

Usage

1
summaryMSDSE(data, factors, dvs, withinCorrection = NULL)

Arguments

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).

Value

dataframe

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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")
)

psychReport documentation built on May 6, 2021, 5:05 p.m.