ch.mergeChoiceDataWithOverlapsData: A function to prepare the morals data for analysis

ch.mergeChoiceDataWithOverlapsDataR Documentation

A function to prepare the morals data for analysis

Description

This function prepares the morals data for analysis by creating overlapRound, correct, and a few other columns. It also makes sure the trials starts at 1, and computes average p(hit) and RT for each subject.

Usage

ch.mergeChoiceDataWithOverlapsData(
  data,
  overlap.data,
  overlapCol,
  directionCol,
  respChoiceCol,
  respChoiceVal = c("Item1", "Item2"),
  item1cols = c("Item1"),
  item2cols = c("Item2"),
  overlapItem1cols = c("IA1"),
  overlapItem2cols = c("IB1"),
  roundThreshold = 0.1,
  roundDirection = ceiling,
  numOverlapBins = 10,
  outfile = NULL,
  overlapDataIsComplete = FALSE
)

Arguments

data

A dataframe with the choice data from a typical PVT experiment.

overlap.data

A dataframe with the overlap data processed from a typical values experiment.

overlapCol

a string that specifies the name of the column in "data" that contains the overlaps for the item in each trial.

directionCol

a string that specifies the name of the column in "data" that contains the direction of the overlap for each trial.

respChoiceCol

a string that specifies the name of the column in "data" that contains the the participant's response to the prompt - yes take action or no take no action.

respChoiceVal

a vector of two values that specifies the choose Item1 option ("yes" take action in many morals experimants, thus saving Item1) value (index 1) and the choose Item1 option ("no" take no action in many morals experimants, thus saving Item2) value (index 2).

item1cols

a vector of strings that specifies the names of the columns in "data" that contains the the probes in Item 1.

item2cols

a vector of strings that specifies the names of the columns in "data" that contains the the probes in Item 2.

overlapItem1cols

a vector of strings that specifies the names of the columns in the overlaps data (overlap.data) that contains the correspoinding probes in Item 1.

overlapItem2cols

a vector of strings that specifies the names of the columns in the overlaps data (overlap.data) that contains the correspoinding probes in Item 2.

roundThreshold

An integer that specifies the nearest interval that the overlaps should be rounded to. DEFAULT = 0.1 (round to the nearest 0.1)

roundDirection

An option that specifies the rounding direction: ceiling (always round up), floor (always round down), or round (round to the nearest value, up or down). DEFAULT = ceiling

numOverlapBins

An integer that specifies the number of bins the overlaps should be binned into. This is only used if roundThreshold = NULL. DEFAULT = 10 (round overlaps so that there are 10 bins)

overlapDataIsComplete

A boolean that specifies whether the overlap data contains all the possible trial stimuli in the exact column order (TRUE) or whether the overlap file contains the trial stimuli in only one order and therefore has to be permuted to be merged with the choice data (FALSE). DEFAULT = FALSE.

outputFile

the filename that you want the output written to. DEFAULT = NULL (no file written)

params

a list of parameters that are read in using "ch.readMoralsDBfile.r."

Value

a dataframe of merged data.

Examples

ch.mergeChoiceDataWithOverlapsData (data=moralsData, "sn", "RT", "overlap", "direction", "trials", "respDef", respChoiceVal = c("Yes", "No"))

ccpluncw/ccpl_R_chMorals documentation built on Feb. 4, 2024, 3:30 p.m.