Replaces the `ppid` and `session_num` of data in your trial results. This is used if, for example, you must repeat some specific trials with a participant under a new PPID. This replaces the trials found in the trial results with those under the alternative ppid. They are marked with a new session number to allow them to be distinguished. Any episodes (as defined by the string in the episode column) are replaced with those in the replacement session. Often, trials are repeated because of a failure. If `last_trial_exclude` is set to 1, then the last trial from the previous session of the matched ppid will be excluded. Afterwards, in case the exact same trial was repeated in a row, only the first occurrence will be retained.

apply_replacements(df, replacements_df)

Arguments

df

A trial results data frame.

replacements_df

A data frame with columns `"ppid_old"`,`"ppid_new"`,`"session_num_new"`, `"last_trial_exclude"`