om_ttest: Run T-Tests on Long Format data

Description Usage Arguments Examples

Description

This function performs t-tests on v6 and v7 data

Usage

1
om_ttest(gathered_dat, comparison)

Arguments

gathered_dat

Long format data

comparison

Three possible comparisons "PrePost", "PreFollowUpT1T2" or "PreFollowUpT1T3". "PreFollowUpT1T2" performs Pre-Post comparison only for people who completed the FollowUp. "PreFollowUpT1T3" is the same sample of people (only those who completed the FollowUp) but compares them Pre-FollowUp.

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
## Get Key (may differ in your code)
key <- readr::read_lines("../../Research/Projects/Keys/airtabler.txt")

## get v7 data
assessmentv7 <- om_download_at(key,
                               tables = "AssessmentV7",
                               clean = TRUE)

## Perform t-test on a single variable
assessmentv7 %>%
  om_gather("AffPol1") %>%
  om_ttest(comparison = "PrePost")

## get results for all variables
assessmentv7  %>%
  ## select only relevant variables and composite scores
  select(OMID, AffPol1Pre:IHCultureSub3FollowUp) %>%
  ## turn data into long format
  om_gather(which_strings = v7_var_strings)  %>%
  ## perform t-test on each variable (for Pre and Post)
  om_ttest("PrePost") %>%
  ## arrange by cohens D
  arrange(desc(cohend))

## get v6 data
assessmentv6 <- om_download_at(key,
                               tables = "AssessmentV6",
                               clean = TRUE)

## get results for all variables
assessmentv6  %>%
  ## select only relevant variables and composite scores
  select(OMID, AffPol1Pre:IntellectualHumilityFollowUp,
         GrowthMindsetPre, GrowthMindsetPost, GrowthMindsetFollowUp,
         C1Pre, C5Pre, C6Pre,
         C1Post, C5Post, C6Post,
         C1FollowUp, C5FollowUp, C6FollowUp,
         -contains("Preparedness3")) %>%
  ## turn data into long format
  om_gather(which_strings = v6_var_strings)  %>%
  ## perform t-test on each variable (for Pre and Post)
  om_ttest("PrePost") %>%
  ## arrange by cohens D
  arrange(desc(cohend))

openmindplatform/openmindR documentation built on Nov. 13, 2021, 2:13 p.m.