Function for separating the conditioned responses into multiple pieces

chop_cs(cs, data, subj, group = NULL, prefix = "cs", na.rm = FALSE)

Arguments

cs

The column name(s) of the conditioned responses

data

A data frame containing all the relevant columns for the analyses

subj

The name of the column including the participant numbers. Unique numbers are expected

group

default to NULL

prefix

prefix to be included in the end data frame

na.rm

Whether NAs should be removed, default to FALSE

Value

A tibble with the following column names: "id" = id column; "top10per" = mean of top 10"bottom10per" = mean of bottom 10"minfirst = all trials minus the first one; "all" = mean of all trials; "t33per = mean of top 33"m33per" = mean of medium 33"b33per" = mean of bottom 33"fhalf" = mean of first half of the trials; "lhalf" = mean of last half of the trials; "ftrial" = first trial; "ltrial" = last trial; "t20per" = mean of top 20"b20per" = mean of bottom 20"f2trial" = mean of first two trials; "l2trial" = mean of last two trials; "per2_X" = mean per two trials (i.e., block), with X referring to the number of block.

Examples

data(example_data)
chop_cs(cs = paste0("CSP", 1:10), data = example_data, subj = "id")
#> # A tibble: 40 × 32
#>       id cs_t_1 cs_t_2 cs_t_3 cs_t_4 cs_t_5 cs_t_6 cs_t_7 cs_t_8 cs_t_9 cs_t_10
#>    <int>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>   <dbl>
#>  1     2 0.629  0.930   1.04   0.933  0.974  0.886  0.842  0.982  0.579   0.382
#>  2     3 7.08   4.98   12.8    8.28   4.98   8.87   8.25   0.761  1.77    2.18 
#>  3     4 0      1.22    2.44   4.51   5.34   4.68   3.65   2.10   6.48    2.64 
#>  4     5 1.44   0.971   0.378  1.44   0.406  1.60   1.53   1.19   0.399   0.617
#>  5     7 0.945  3.29    3.44   2.71   3.64   3.89   3.62   2.29   5.28    4.52 
#>  6     8 3.24   2.34    2.39   2.29   1.96   2.51   2.42   2.72   3.75    0.551
#>  7     9 0.438  0.0467  0.231  2.24   1.62   1.86   1.74   1.60   0.873   2.55 
#>  8    10 0.0391 0.208   0.465  0.540  0.450  0.552  0.414  0.318  0.456   0.343
#>  9    11 0.885  1.65    0.961  0.743  0.208  2.29   1.81   1.73   1.87    0.906
#> 10    12 2.62   2.24    2.55   1.81   2.69   2.08   3.13   3.23   2.55    1.84 
#> # … with 30 more rows, and 21 more variables: cs_t10per <dbl>, cs_b10per <dbl>,
#> #   cs_minfirst <dbl>, cs_all <dbl>, cs_t33per <dbl>, cs_m33per <dbl>,
#> #   cs_b33per <dbl>, cs_fhalf <dbl>, cs_lhalf <dbl>, cs_ftrial <dbl>,
#> #   cs_ltrial <dbl>, cs_t20per <dbl>, cs_b20per <dbl>, cs_f2trial <dbl>,
#> #   cs_l2trial <dbl>, cs_per2_1 <dbl>, cs_per2_2 <dbl>, cs_per2_3 <dbl>,
#> #   cs_per2_4 <dbl>, cs_per2_5 <dbl>, cs_l5trial <dbl>