ezDesign: Plot the balance of data in an experimental design

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ezDesign.R

Description

This function provides easy visualization of the balance of data in a data set given a specified experimental design. This function is useful for identifying missing data and other issues (see examples).

Usage

1
2
3
4
5
6
7
8
ezDesign(
    data
    , x
    , y
    , row = NULL
    , col = NULL
    , cell_border_size = 10
)

Arguments

data

Data frame containing the data to be visualized.

x

Name of the variable to plot on the x-axis.

y

Name of the variable to plot on the y-axis.

row

Name of a variable by which to split the data into facet rows.

col

Name of a variable by which to split the data into facet columns.

cell_border_size

Numeric value specifying the size of the border seperating cells (0 specifies no border)

Details

The function works by counting the number of rows in data in each cell of the design specified by the factorial combination of x, y, row, col variables.

Value

A printable/modifiable ggplot2 object.

Author(s)

Michael A. Lawrence mike.lwrnc@gmail.com
Visit the ez development site at http://github.com/mike-lawrence/ez
for the bug/issue tracker and the link to the mailing list.

See Also

ezPrecis

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
#Read in the ANT2 data (see ?ANT2).
data(ANT2)
head(ANT2)
ezPrecis(ANT2)

#toss NA trials
ANT2 = ANT2[!is.na(ANT2$rt),]

ezDesign(
    data = ANT2
    , x = trial
    , y = subnum
    , row = block
    , col = group
)
#subnum #7 is missing data from the last half of the experiment

## Not run: 
ezDesign(
    data = ANT2
    , x = flank
    , y = subnum
    , row = cue
)
#again, subnum#7 has half the data as the rest

#now look at error rates, which affect the number of RTs we can use
ezDesign(
    data = ANT2[ANT2$error==0,]
    , x = flank
    , y = subnum
    , row = cue
)
#again, subnum#7 stands out because they have half the data as the rest
#also, subnum#14 has no data in any incongruent cells, suggesting that
##they made all errors in this condition
#finally, subnum#12 has virtually no data, suggesting that they mistakenly
##swapped responses

## End(Not run)

Example output

  subnum     group block trial     cue     flank location direction       rt
1      1 Treatment     1     1    None   Neutral       up      left 398.6773
2      1 Treatment     1     2  Center   Neutral       up      left 389.1822
3      1 Treatment     1     3  Double   Neutral       up      left 333.2186
4      1 Treatment     1     4 Spatial   Neutral       up      left 419.7640
5      1 Treatment     1     5    None Congruent       up      left 446.4754
6      1 Treatment     1     6  Center Congruent       up      left 338.9766
  error
1     0
2     0
3     0
4     0
5     0
6     0
Data frame dimensions: 5760 rows, 10 columns
             type missing values      min         max
subnum    numeric       0     20        1          20
group      factor       0      2  Control   Treatment
block     numeric       0      6        1           6
trial      factor       0     48        1          48
cue        factor       0      4     None     Spatial
flank      factor       0      3  Neutral Incongruent
location   factor       0      2     down          up
direction  factor       0      2     left       right
rt        numeric     144   5617 179.5972    657.6986
error     numeric     144      3        0           1

ez documentation built on May 2, 2019, 3:46 a.m.