statStrT: statStrT

Description Usage Arguments Value Examples

View source: R/ttest.R

Description

Returns required Latex formatted string T-test required for R/Knitr integration. For example, t(11) = 3.45, p < 0.05. Returns values to 2 sig decimal places and < 0.01, < 0.001 for p values.

Usage

1
statStrT(tObj)

Arguments

tObj

The returned object from a call to t.test

Value

character

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
requiredPackages(c("dplyr"))

# Example 1:
# create dataframe and add data with 2(Comp: comp vs. incomp) levels
dat <- createDF(nVP = 20,
                nTrl = 50,
                design = list("Comp" = c("comp", "incomp")))

dat <- addDataDF(dat, RT = list("Comp comp"   = c(500, 150, 100),
                                "Comp incomp" = c(520, 150, 100)))

# aggregate dat across trials
datAggVP <- dat %>%
    group_by(VP, Comp) %>%
    summarize(N  = n(),
              rt = mean(RT))

tObj <- t.test(datAggVP$rt[datAggVP$Comp == "comp"],
               datAggVP$rt[datAggVP$Comp == "incomp"],
               paired = TRUE)

statStrT <- statStrT(tObj)

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