Skip to contents

Filter raw or scored data to get a subset of trials or study/recall pairings.

Usage

filter_data(
  data,
  subjects = NULL,
  lists = NULL,
  trial_type = NULL,
  positions = NULL,
  inputs = NULL,
  outputs = NULL
)

Arguments

data

Raw or merged data to filter.

subjects

Subject or subjects to include.

lists

List or lists to include.

trial_type

Trial type to include.

positions

Position or positions to include.

inputs

Input position or positions to include.

outputs

Output position or positions to include.

Value

The filtered subset of data.

Examples

# Filter data to get study events for subject 1
subjects_list <- list(1, 1, 2, 2)
study_lists <- list(
  list("a", "b"), list("c", "d"), list("e", "f"), list("g", "h")
)
recall_lists <- list(list("b"), list("d", "c"), list("f", "e"), list())
raw <- table_from_lists(subjects_list, study_lists, recall_lists)
filter_data(raw, subjects = 1, trial_type = "study")
#>   subject list trial_type position item
#> 0       1    1      study        1    a
#> 1       1    1      study        2    b
#> 3       1    2      study        1    c
#> 4       1    2      study        2    d

# Filtered scored data to get subject 2
data <- merge_free_recall(raw)
filter_data(data, subjects = 2)
#>   subject list item input output study recall repeat intrusion prior_list
#> 4       2    1    e     1      2  TRUE   TRUE      0     FALSE        NaN
#> 5       2    1    f     2      1  TRUE   TRUE      0     FALSE        NaN
#> 6       2    2    g     1    NaN  TRUE  FALSE      0     FALSE        NaN
#> 7       2    2    h     2    NaN  TRUE  FALSE      0     FALSE        NaN
#>   prior_input
#> 4         NaN
#> 5         NaN
#> 6         NaN
#> 7         NaN