Skip to contents

Subset the associatoR object.

Usage

ar_subset(associations, ...)

Arguments

associations

an associatoR object containing association data as generated by ar_import.

...

optional logical comparisons filtering the participants, cues, or responses. Multiple filter arguments will be combined with an AND logic.

Value

Returns an associatoR object containing a list of tibbles:

participants

A tibble of participants including a participant id and potential participant attributes.

cues

A tibble of cues including a cue variable and potential cue attributes.

responses

A tibble of responses including a participant id, the cues, the responses, the response level, and additional response attributes.

Details

Note that ar_subset() resets the associatoR object. Potential targets and target_embedding tibbles will be removed and have to be added again using ar_set_targets.

Examples


ar_import(intelligence,
          participant = participant_id,
          cue = cue,
          response = response,
          participant_vars = c(gender, education),
          response_vars = c(response_position, response_level)) %>%
  ar_subset(gender == "female", education == "high school")
#> 
#> ── An associatoR object ────────────────────────────────────────────────────────
#> 
#> participants
#> # A tibble: 250 × 3
#>      id gender education  
#>   <dbl> <chr>  <chr>      
#> 1   501 female high school
#> 2   502 female high school
#> 3   503 female high school
#> 4   504 female high school
#> 5   505 female high school
#> # ℹ 245 more rows
#> 
#> cues
#> # A tibble: 400 × 1
#>   cue         
#>   <chr>       
#> 1 intelligence
#> 2 Smart       
#> 3 education   
#> 4 books       
#> 5 genius      
#> # ℹ 395 more rows
#> 
#> responses
#> # A tibble: 7,470 × 5
#>      id cue          response        response_position response_level
#>   <dbl> <chr>        <chr>                       <dbl>          <dbl>
#> 1   501 intelligence Smart                           1              1
#> 2   501 intelligence education                       2              1
#> 3   501 intelligence books                           3              1
#> 4   501 intelligence genius                          4              1
#> 5   501 intelligence Albert Einstein                 5              1
#> # ℹ 7,465 more rows
#>