d_point: Plot either IAT or SC-IAT scores (points)

View source: R/d_point.R

d_pointR Documentation

Plot either IAT or SC-IAT scores (points)

Description

Plot the individual D-score or SC-IAT D.

Usage

d_point(
  data,
  point_size = 1,
  x_label = "Participant",
  x_values = TRUE,
  order_sbj = c("default", "D-increasing", "D-decreasing"),
  col_point = "springgreen4",
  include_stats = FALSE
)

Arguments

data

Dataframe with either class dscore or dsciat.

point_size

Numeric. Indicates the size of the points in the graph. Default is 1.

x_label

Character. Label of the x-axis. Default is Participant.

x_values

Logical. Shows the values for x-axis (default = TRUE).

order_sbj

Character. Defines the order with which the participants are displayed. Default is the default order of participants in the dataframe.

col_point

Character. Defines the color of the points. Default is "springgreen4".

include_stats

Logical. Indicates whether to add descriptive statistics. The mean is depicted with a solid line. The two dashed lines represent +/2 s.d. from the mean. Default is FALSE.

Value

A ggplot object

Examples


# Plotting the IAT D-score
  data("raw_data") # import data
  iat_cleandata <- clean_iat(raw_data, sbj_id = "Participant",
                          block_id = "blockcode",
                          mapA_practice = "practice.iat.Milkbad",
                          mapA_test = "test.iat.Milkbad",
                          mapB_practice = "practice.iat.Milkgood",
                          mapB_test = "test.iat.Milkgood",
                          latency_id = "latency",
                          accuracy_id = "correct",
                          trial_id = "trialcode",
                          trial_eliminate = c("reminder", "reminder1"),
                          demo_id = "blockcode",
                          trial_demo = "demo")
  iat_data <- iat_cleandata[[1]]
# calculate D-score
  iat_dscore <- compute_iat(iat_data,
                       Dscore =  "d2")
  d_point(iat_dscore) # default plot
  d_point(iat_dscore, order_sbj = "D-increasing") # D-score with increasing
                                                 # order
  d_point(iat_dscore, order_sbj = "D-decreasing",
         col_point = "salmon") # D-score with decreasing order changed color
# Plot the SC-IAT D for the first SC-IAT
  data("raw_data") # load data
  sciat_data <- clean_sciat(raw_data, sbj_id = "Participant",
                         block_id = "blockcode",
                         latency_id = "latency",
                         accuracy_id = "correct",
                         block_sciat_1 = c("test.sc_dark.Darkbad",
                                           "test.sc_dark.Darkgood"),
                         block_sciat_2 = c("test.sc_milk.Milkbad",
                                           "test.sc_milk.Milkgood"),
                         trial_id  = "trialcode",
                         trial_eliminate = c("reminder",
                                             "reminder1"))

 sciat1 <- sciat_data[[1]] # compute D for the first SC-IAT
 d_sciat1 <- compute_sciat(sciat1,
                  mappingA = "test.sc_dark.Darkbad",
                  mappingB = "test.sc_dark.Darkgood",
                  non_response = "alert")
  d_point(d_sciat1, col_point = "salmon",
          include_stats = TRUE) # SC-IAT D with descriptive statistics
          

implicitMeasures documentation built on March 18, 2022, 5:17 p.m.