Skip to contents

ar_normalize_dict offers an interface to normalization responses (and cues) in associatoR objects based on a dictionary.

Usage

ar_normalize_dict(associations, dictionary, process_cues = FALSE)

Arguments

associations

an associatoR object containing association data as generated by ar_import.

dictionary

a data.frame consisting of two columns named c("old","new").

process_cues

a logical indicating if cues should be processed (i.e. changed by fun) or not.

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. All responses are passed through fun

References

Aeschbach, S., Mata, R., Wulff, D. U. (in progress)

Examples

dict <- data.frame(old = c("intelligence", "iq"),
                   new = c("Intelligence", "IQ"))

ar_import(intelligence,
          participant = participant_id,
          cue = cue,
          response = response,
          participant_vars = c(gender, education),
          response_vars = c(response_position, response_level)) %>%
  ar_normalize_dict(dict)
#> 
#> ── An associatoR object ────────────────────────────────────────────────────────
#> 
#> participants
#> # A tibble: 1,000 × 3
#>      id gender education  
#>   <dbl> <chr>  <chr>      
#> 1     1 male   high school
#> 2     2 male   high school
#> 3     3 male   high school
#> 4     4 male   high school
#> 5     5 male   high school
#> # ℹ 995 more rows
#> 
#> cues
#> # A tibble: 804 × 1
#>   cue         
#>   <chr>       
#> 1 intelligence
#> 2 Einstein    
#> 3 books       
#> 4 IQ tests    
#> 5 college     
#> # ℹ 799 more rows
#> 
#> responses
#> # A tibble: 29,882 × 6
#>      id cue          response     response_position response_level response_orig
#>   <dbl> <chr>        <chr>                    <dbl>          <dbl> <chr>        
#> 1     1 intelligence Einstein                     1              1 Einstein     
#> 2     1 intelligence books                        2              1 books        
#> 3     1 intelligence IQ tests                     3              1 IQ tests     
#> 4     1 intelligence college                      4              1 college      
#> 5     1 intelligence smart people                 5              1 smart people 
#> # ℹ 29,877 more rows
#>