Plots average looks to interest areas.

Share:

Description

plot_avg calculates the grand or conditional averages of looks to each interest area along with standard error. It then plots the results. N.B.: This function will work for data with a maximum of 8 interest areas and 2 conditions.

Usage

1
2
3
plot_avg(data, type = NULL, xlim = NA, IAColumns = NULL,
  Condition1 = NA, Condition2 = NA, Cond1Labels = NA, Cond2Labels = NA,
  ErrorBar = TRUE, VWPreTheme = TRUE)

Arguments

data

A data table object output by either bin_prop. transform_to_elogit, or create_binomial.

type

A character string indicating "proportion" or "elogit".

xlim

A vector of two integers specifying the limits of the x-axis.

IAColumns

A named character vector specifying the desired interest area columns with custom strings for the legend.

Condition1

A string containing the column name corresponding to the first condition, if available.

Condition2

A string containing the column name corresponding to the second condition, if available.

Cond1Labels

A named character vector specifying the desired custom labels of the levels of the first condition.

Cond2Labels

A named character vector specifying the desired custom labels of the levels of the second condition.

ErrorBar

A logical indicating whether standard error bars should included in the plot.

VWPreTheme

A logical indicating whether the theme included with the function should be applied, or ggplot2's base theme (to which any other custom theme could be added).

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
## Not run: 
library(VWPre)
# For plotting the grand average with the included theme
plot_avg(data = dat, type = "elogit", xlim = c(0, 1000), 
   IAColumns = c(IA_1_ELogit = "Target", IA_2_ELogit = "Rhyme", 
   IA_3_ELogit = "OnsetComp", IA_4_ELogit = "Distractor"),
   Condition1 = NA, Condition2 = NA, Cond1Labels = NA, Cond2Labels = NA,
   ErrorBar = TRUE, VWPreTheme = TRUE) 

# For plotting conditional averages (one condition) with the included theme.
# This produces plots arranged vertically.
plot_avg(data = dat, type = "elogit", xlim = c(0, 1000), 
   IAColumns = IAColumns = c(IA_1_ELogit = "Target", IA_2_ELogit = "Rhyme", 
   IA_3_ELogit = "OnsetComp", IA_4_ELogit = "Distractor"),
   Condition1 = "talker", Condition2 = NA, 
   Cond1Labels = c(CH1 = "Chinese 1", CH10 = "Chinese 3", CH9 = "Chinese 2", 
   EN3 = "English 1"), Cond2Labels = NA, ErrorBar = TRUE, VWPreTheme = TRUE)

# For plotting conditional averages (one condition) with the included theme.
# This produces plots arranged horizontally
plot_avg(data = dat, type = "elogit", xlim = c(0, 1000), 
   IAColumns = IAColumns = c(IA_1_ELogit = "Target", IA_2_ELogit = "Rhyme", 
   IA_3_ELogit = "OnsetComp", IA_4_ELogit = "Distractor"),
   Condition1 = NA, Condition2 = "talker", Cond1Labels = NA, 
   Cond2Labels = c(CH1 = "Chinese 1", CH10 = "Chinese 3", CH9 = "Chinese 2", 
   EN3 = "English 1"), ErrorBar = TRUE, VWPreTheme = TRUE)

# For plotting conditional averages (two conditions) with the included theme.
# This produces plots arranged in grid format.
plot_avg(data = dat, type = "elogit", xlim = c(0, 1000),
   IAColumns = IAColumns = c(IA_1_ELogit = "Target", IA_2_ELogit = "Rhyme", 
   IA_3_ELogit = "OnsetComp", IA_4_ELogit = "Distractor"),
   Condition1 = "talker", Condition2 = "Exp",
   Cond1Labels = c(CH1 = "Chinese 1", CH10 = "Chinese 3", CH9 = "Chinese 2", 
   EN3 = "English 1"), Cond2Labels = c(High = "H Exp", Low = "L Exp"),
   ErrorBar = TRUE, VWPreTheme = TRUE)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.