apa.ezANOVA.table: Creates an ANOVA table in APA style based output of ezANOVA...

Description Usage Arguments Value Examples

View source: R/apaEZANOVA.R

Description

Creates an ANOVA table in APA style based output of ezANOVA command from ez package

Usage

1
2
apa.ezANOVA.table(ez_output, correction = "GG", table.title = "", filename,
  table.number = NA)

Arguments

ez_output

Output object from ezANOVA command from ez package

correction

Type of sphercity correction: sphericity assumed (use "none"), .....

table.title

String containing text for table title

filename

(optional) Output filename document filename (must end in .rtf or .doc only)

table.number

Integer to use in table number output line

Value

APA table object

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
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#
# ** Example 1: Between Participant Predictors
# Be sure use the options command, as below, to ensure sufficient digits

library(apaTables)
print(goggles)

# Use ezANOVA

library(ez)
options(digits = 10)
goggles_results <- ezANOVA(data = goggles,
                          dv = attractiveness,
                          between = .(gender, alcohol),
                          participant ,
                          detailed = TRUE)

# Make APA table

goggles_table <- apa.ezANOVA.table(goggles_results)
print(goggles_table)



#
# ** Example 2: Within Participant Predictors
# Be sure use the options command, as below, to ensure sufficient digits

library(apaTables)
print(drink_attitude_wide)

# Convert data from wide format to long format when using within particpant predictors

library(tidyverse)

drink_attitude_long <- gather(data = drink_attitude_wide,
                              key = group, value = attitude,
                              beer_positive:water_neutral,
                              factor_key=TRUE)

drink_attitude_long <- separate(data = drink_attitude_long,
                                col = group, into = c("drink","imagery"),
                                sep = "_", remove = FALSE)

drink_attitude_long$drink <- as.factor(drink_attitude_long$drink)
drink_attitude_long$imagery <- as.factor(drink_attitude_long$imagery)

# Set contrasts to match Field et al. (2012) textbook output

alcohol_vs_water <- c(1, 1, -2)
beer_vs_wine <- c(-1, 1, 0)
negative_vs_other <- c(1, -2, 1)
positive_vs_neutral <- c(-1, 0, 1)
contrasts(drink_attitude_long$drink) <- cbind(alcohol_vs_water, beer_vs_wine)
contrasts(drink_attitude_long$imagery) <- cbind(negative_vs_other, positive_vs_neutral)


# Use ezANOVA

library(ez)
options(digits = 10)
drink_attitude_results <- ezANOVA(data = drink_attitude_long,
                   dv = .(attitude), wid = .(participant),
                   within = .(drink, imagery),
                   type = 3, detailed = TRUE)

# Make APA table

drink_table <- apa.ezANOVA.table(drink_attitude_results)
print(drink_table)




#'
# ** Example 3: Between and Within Participant Predictors
# Be sure use the options command, as below, to ensure sufficient digits

library(apaTables)
print(dating_wide)

# Convert data from wide format to long format when using within particpant predictors

library(tidyverse)

dating_long <- gather(data = dating_wide,
                     key = group, value = date_rating,
                     attractive_high:ugly_none,
                     factor_key = TRUE)

dating_long <- separate(data = dating_long,
                       col = group, into = c("looks","personality"),
                       sep = "_", remove = FALSE)

dating_long$looks <- as.factor(dating_long$looks)
dating_long$personality <- as.factor(dating_long$personality)

# Set contrasts to match Field et al. (2012) textbook output

some_vs_none <- c(1, 1, -2)
hi_vs_av <- c(1, -1, 0)
attractive_vs_ugly <- c(1, 1, -2)
attractive_vs_average <- c(1, -1, 0)
contrasts(dating_long$personality) <- cbind(some_vs_none, hi_vs_av)
contrasts(dating_long$looks) <- cbind(attractive_vs_ugly, attractive_vs_average)

# Use ezANOVA

library(ez)
options(digits = 10)
dating_results <-ezANOVA(data = dating_long, dv = .(date_rating), wid = .(participant),
                        between = .(gender), within = .(looks, personality),
                        type = 3, detailed = TRUE)

# Make APA table
dating_table <- apa.ezANOVA.table(dating_results)
print(dating_table)

dstanley4/apaTables documentation built on Feb. 20, 2018, 2:18 a.m.