1 Randomization Table

# Repetate
set.seed(101)
eeg_rand <- block.random(40, c(Condition1 = 2, Instructor1 = 2, Order1 = 2)) 
table_eeg_rand <- 
  eeg_rand %>% 
  as.data.frame(.) %>%  
  mutate(Condition1 = case_when(Condition1 == 1 ~ "ogl" ,
                                Condition1 == 2 ~ "ctrl", 
                                TRUE ~ NA_character_)) %>%
  mutate(Instructor1 = case_when(Instructor1 == 1 ~ "Alexandra" ,
                                 Instructor1 == 2 ~ "Romina", 
                                 TRUE ~ NA_character_)) %>%
  mutate(Order1 = case_when(Order1 == 1 ~ "Instr-Solo" ,
                            Order1 == 2 ~ "Solo-Instr", 
                            TRUE ~ NA_character_)) %>%
  mutate(Condition2 = if_else(Condition1 == "ogl", "ctrl", "ogl")) %>%
  mutate(Instructor2 = if_else(Instructor1 == "Alexandra", "Romina", "Alexandra")) %>%
  mutate(Order2 = if_else(Order1 == "Instr-Solo", "Solo-Instr", "Instr-Solo")) %>%
  mutate(ID = 1:nrow(.)) 
table_eeg_rand %>%                              # excel downloadable  DT table
  select(blocks, ID, everything()) %>%
    DT::datatable(
      extensions = 'Buttons',
      options = list(pageLength = 40,
                     dom = 'Bfrtip', 
                     buttons = c('excel', "csv")))

# kable table
# table_eeg_rand %>%                             
#   select(blocks, ID, everything()) %>%
#   knitr::kable(caption = "Randomization Table", align = rep('c', 6))


1.1 Check cross-tabs for each day

table_eeg_rand %>%
  select(Condition1, Instructor1, Order1) %>%
  ftable(row.vars = 1)
           Instructor1  Alexandra                Romina           
           Order1      Instr-Solo Solo-Instr Instr-Solo Solo-Instr
Condition1                                                        
ctrl                            5          5          5          5
ogl                             5          5          5          5
  # knitr::kable()
table_eeg_rand %>%
  select(Condition2, Instructor2, Order2) %>%
  ftable(row.vars = 1)
           Instructor2  Alexandra                Romina           
           Order2      Instr-Solo Solo-Instr Instr-Solo Solo-Instr
Condition2                                                        
ctrl                            5          5          5          5
ogl                             5          5          5          5
# all conditions are balanced by block
# table_eeg_rand %>%
#   filter(blocks == 1) %>%
#   select(Condition1, Instructor1, Order1) %>%
#   ftable(row.vars = 1)


1.2 Check balance

# pairs.panels(eeg_rand)
table_eeg_rand %>%
  select(-ID, -blocks) %>%
    pairs.panels()


2 Session Info

R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Romanian_Romania.1250  LC_CTYPE=Romanian_Romania.1250    LC_MONETARY=Romanian_Romania.1250 LC_NUMERIC=C                     
[5] LC_TIME=Romanian_Romania.1250    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] bindrcpp_0.2.2    DT_0.5            papaja_0.1.0.9842 psych_1.8.10      forcats_0.3.0     stringr_1.3.1     dplyr_0.7.8      
 [8] purrr_0.2.5       readr_1.3.0       tidyr_0.8.2       tibble_1.4.2      ggplot2_3.1.0     tidyverse_1.2.1   pacman_0.5.0     

loaded via a namespace (and not attached):
 [1] tidyselect_0.2.5 xfun_0.4         haven_2.1.0      lattice_0.20-38  colorspace_1.3-2 generics_0.0.2   htmltools_0.3.6  yaml_2.2.0      
 [9] rlang_0.3.1      later_0.7.5      pillar_1.3.1     foreign_0.8-71   glue_1.3.0       withr_2.1.2      modelr_0.1.2     readxl_1.1.0    
[17] bindr_0.1.1      plyr_1.8.4       munsell_0.5.0    gtable_0.2.0     cellranger_1.1.0 rvest_0.3.2      htmlwidgets_1.3  knitr_1.21      
[25] httpuv_1.4.5     crosstalk_1.0.0  parallel_3.5.2   broom_0.5.1      Rcpp_1.0.0       xtable_1.8-3     promises_1.0.1   scales_1.0.0    
[33] backports_1.1.3  jsonlite_1.6     mime_0.6         mnormt_1.5-5     digest_0.6.18    hms_0.4.2        stringi_1.2.4    shiny_1.2.0     
[41] grid_3.5.2       cli_1.0.1        tools_3.5.2      magrittr_1.5     lazyeval_0.2.1   crayon_1.3.4     pkgconfig_2.0.2  xml2_1.2.0      
[49] lubridate_1.7.4  assertthat_0.2.0 httr_1.4.0       rstudioapi_0.8   R6_2.3.0         nlme_3.1-137     compiler_3.5.2  
 

A work by Claudiu Papasteri

claudiu.papasteri@gmail.com

 

LS0tDQp0aXRsZTogIjxicj4gQmFsYW5jZWQgcmFuZG9taXphdGlvbiBmb3IgRUVHIE8uNCIgDQpzdWJ0aXRsZTogIlJhbmRvbWl6YXRpb24gZm9yIFJlcGVhdGVkIFN0aW11bGkgRXhwZXJpbWVudCINCmF1dGhvcjogIjxicj4gQ2xhdWRpdSBQYXBhc3RlcmkiDQpkYXRlOiAiYHIgZm9ybWF0KFN5cy50aW1lKCksICclZCAlbSAlWScpYCINCm91dHB1dDogDQogICAgaHRtbF9ub3RlYm9vazoNCiAgICAgICAgICAgIGNvZGVfZm9sZGluZzogaGlkZQ0KICAgICAgICAgICAgdG9jOiB0cnVlDQogICAgICAgICAgICB0b2NfZGVwdGg6IDINCiAgICAgICAgICAgIG51bWJlcl9zZWN0aW9uczogdHJ1ZQ0KICAgICAgICAgICAgdGhlbWU6IHNwYWNlbGFiDQogICAgICAgICAgICBoaWdobGlnaHQ6IHRhbmdvDQogICAgICAgICAgICBmb250LWZhbWlseTogQXJpYWwNCiAgICAgICAgICAgIGZpZ193aWR0aDogMTANCiAgICAgICAgICAgIGZpZ19oZWlnaHQ6IDkNCiAgICBwZGZfZG9jdW1lbnQ6IA0KICAgICAgICAgICAgdG9jOiB0cnVlDQogICAgICAgICAgICB0b2NfZGVwdGg6IDINCiAgICAgICAgICAgIG51bWJlcl9zZWN0aW9uczogdHJ1ZQ0KICAgICAgICAgICAgIyBmb250c2l6ZTogMTFwdA0KICAgICAgICAgICAgIyBnZW9tZXRyeTogbWFyZ2luPTFpbg0KICAgICAgICAgICAgIyBmaWdfd2lkdGg6IDcNCiAgICAgICAgICAgICMgZmlnX2hlaWdodDogNg0KICAgICAgICAgICAgIyBmaWdfY2FwdGlvbjogdHJ1ZQ0KLS0tDQoNCg0KYGBge3Igc2V0dXAsIGluY2x1ZG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