tValueString: tValueString

Description Usage Arguments Value Examples

View source: R/ttest.R

Description

Returns required Latex formatted string for t(df) = XXX for R/knitr integration. Returns values to 2 sig decimal places.

Usage

1

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)

tString <- tValueString(tObj)

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