Main File for S2 main CAM study

Author

Julius Fenn, Louisa Estadieu

Notes

prepare data

set up data.frame questionnaires

setwd("outputs")
# > pre study
suppressMessages(read_file('preCAM.txt') %>%
                   # ... split it into lines ...
                   str_split('\n') %>% first() %>%
                   # ... filter empty rows ...
                   discard(function(x) x == '') %>%
                   discard(function(x) x == '\r') %>%
                   # ... parse JSON into a data.frame
                   map_dfr(fromJSON, flatten=TRUE)) -> dat_preCAM
# > post first CAM
suppressMessages(read_file('postCAM.txt') %>%
                   # ... split it into lines ...
                   str_split('\n') %>% first() %>%
                   # ... filter empty rows ...
                   discard(function(x) x == '') %>%
                   discard(function(x) x == '\r') %>%
                   # ... parse JSON into a data.frame
                   map_dfr(fromJSON, flatten=TRUE)) -> dat_postCAM

# > post second CAM
suppressMessages(read_file('secondPostCAM.txt') %>%
                   # ... split it into lines ...
                   str_split('\n') %>% first() %>%
                   # ... filter empty rows ...
                   discard(function(x) x == '') %>%
                   discard(function(x) x == '\r') %>%
                   # ... parse JSON into a data.frame
                   map_dfr(fromJSON, flatten=TRUE)) -> dat_secondPostCAM



########################################
# create counter variable for both data sets
########################################
### pre study
dat_preCAM$ID <- NA

tmp_IDcounter <- 0
for(i in 1:nrow(dat_preCAM)){
  if(!is.na(dat_preCAM$sender[i]) && dat_preCAM$sender[i] == "Greetings"){
    # tmp <- dat_preCAM$prolific_pid[i]
    tmp_IDcounter = tmp_IDcounter + 1
  }
  dat_preCAM$ID[i] <- tmp_IDcounter
}



### post study
dat_postCAM$ID <- NA

tmp_IDcounter <- 0
for(i in 1:nrow(dat_postCAM)){
  if(!is.na(dat_postCAM$sender[i]) && dat_postCAM$sender[i] == "CAMfeedbackGeneral"){
    # tmp <- dat_postCAM$prolific_pid[i]
    tmp_IDcounter = tmp_IDcounter + 1
  }
  dat_postCAM$ID[i] <- tmp_IDcounter
}

### second post study
#> fix error in "sender variable"
for(i in 1:nrow(dat_secondPostCAM)){
  if(is.na(dat_secondPostCAM$sender[i])){
    if(!is.na(dat_secondPostCAM$sender[i+1])){
      dat_secondPostCAM$sender[i] <- "adaptiveAnswer"
    }
  }
}



dat_secondPostCAM$ID <- NA
tmp_IDcounter <- 0
for(i in 1:nrow(dat_secondPostCAM)){
  if(!is.na(dat_secondPostCAM$sender[i]) && dat_secondPostCAM$sender[i] == "adaptiveAnswer"){
    # tmp <- dat_secondPostCAM$prolific_pid[i]
    tmp_IDcounter = tmp_IDcounter + 1
  }
  dat_secondPostCAM$ID[i] <- tmp_IDcounter
}


########################################
# keep only complete data sets
########################################
### pre-study
# sort(table(dat_preCAM$ID))
sum(table(dat_preCAM$ID) != max(table(dat_preCAM$ID)))
[1] 0
sum(table(dat_preCAM$ID) == max(table(dat_preCAM$ID)))
[1] 193
dat_preCAM <- dat_preCAM[dat_preCAM$ID %in% names(table(dat_preCAM$ID))[table(dat_preCAM$ID) == max(table(dat_preCAM$ID))],]

### post-study
# sort(table(dat_postCAM$ID))
sum(table(dat_postCAM$ID) != max(table(dat_postCAM$ID)))
[1] 2
sum(table(dat_postCAM$ID) == max(table(dat_postCAM$ID)))
[1] 192
# dat_postCAM <- dat_postCAM[dat_postCAM$ID %in% names(table(dat_postCAM$ID))[table(dat_postCAM$ID) == max(table(dat_postCAM$ID))],]
dat_postCAM <- dat_postCAM[dat_postCAM$ID %in% names(table(dat_postCAM$ID))[table(dat_postCAM$ID) >= 4],]

### post-study second
# sort(table(dat_secondPostCAM$ID))
sum(table(dat_secondPostCAM$ID) != max(table(dat_secondPostCAM$ID)))
[1] 2
sum(table(dat_secondPostCAM$ID) == max(table(dat_secondPostCAM$ID)))
[1] 192
# dat_secondPostCAM <- dat_secondPostCAM[dat_secondPostCAM$ID %in% names(table(dat_secondPostCAM$ID))[table(dat_secondPostCAM$ID) == max(table(dat_secondPostCAM$ID))],]
dat_secondPostCAM <- dat_secondPostCAM[dat_secondPostCAM$ID %in% names(table(dat_secondPostCAM$ID))[table(dat_secondPostCAM$ID) >= 11],]



########################################
# json (from JATOS) to 2D data.frame
########################################
################################ pre-study
### !!! add paradata
vec_ques <- c("PROLIFIC_PID",
                "choosen_Robot", 
              "dummy_informedconsent", 
              "commCheck")

vec_notNumeric = c("PROLIFIC_PID",
                "choosen_Robot")

questionnaire_preCAM <- questionnairetype(dataset = dat_preCAM, 
                                        listvars = vec_ques, 
                                        notNumeric = vec_notNumeric, verbose = FALSE)


dim(questionnaire_preCAM)
[1] 193   5
################################ post-study

################################ post-study second
tmp_numeric <- str_subset(string = colnames(dat_secondPostCAM), pattern = "^GAToRS|^Almere|^LiWang")


vec_ques <- c("ans1",
                tmp_numeric,
                "feedback_critic")

vec_notNumeric = c("ans1",
                   "feedback_critic")

questionnaire_secondPostCAM <- questionnairetype(dataset = dat_secondPostCAM, 
                                        listvars = vec_ques, 
                                        notNumeric = vec_notNumeric, verbose = FALSE)


dim(questionnaire_secondPostCAM)
[1] 193  38

set up CAM data

pre

Load CAM data

setwd("outputs")
suppressMessages(read_file("CAMdata.txt") %>%
  # ... split it into lines ...
  str_split('\n') %>% first() %>%
    discard(function(x) x == '') %>%
    discard(function(x) x == '\r') %>%
  # ... filter empty rows ...
  discard(function(x) x == '')) -> dat_CAM_pre

raw_CAM_pre <- list()
for(i in 1:length(dat_CAM_pre)){
  raw_CAM_pre[[i]] <- jsonlite::fromJSON(txt = dat_CAM_pre[[i]])
}

Create CAM files, draw CAMs and compute network indicators

########################################
# create CAM single files (nodes, connectors, merged)
########################################
CAMfiles_pre <- create_CAMfiles(datCAM = raw_CAM_pre, reDeleted = TRUE)
Nodes and connectors, which were deleted by participants were removed. 
 # deleted nodes:  321 
 # deleted connectors:  84
########################################
# draw CAMs
########################################
CAMdrawn_pre <- draw_CAM(dat_merged = CAMfiles_pre[[3]],
                     dat_nodes = CAMfiles_pre[[1]],ids_CAMs = "all",
                     plot_CAM = FALSE,
                     useCoordinates = TRUE,
                     relvertexsize = 3,
                     reledgesize = 1)
processing 193 CAMs... 
[1] "== ids_CAMs in drawnCAM"
########################################
# draw CAMs
########################################
tmp_microIndicator <- c("Rettungsroboter", "sozialer Assistenzroboter", "Vorteile", "Nachteile")
networkIndicators_pre <- compute_indicatorsCAM(drawn_CAM = CAMdrawn_pre, 
                                           micro_degree = tmp_microIndicator, 
                                           micro_valence = tmp_microIndicator, 
                                           micro_centr_clo = tmp_microIndicator, 
                                           micro_transitivity = tmp_microIndicator, 
                                           largestClique = FALSE)


########################################
# wordlists
########################################
CAMwordlist_pre <- create_wordlist(
  dat_nodes =  CAMfiles_pre[[1]],
  dat_merged =  CAMfiles_pre[[3]],
  order = "frequency",
  splitByValence = FALSE,
  comments = TRUE,
  raterSubsetWords = NULL,
  rater = FALSE
)
processing 193 CAMs... 
[1] "== ids_CAMs in drawnCAM"
DT::datatable(CAMwordlist_pre, options = list(pageLength = 5)) 

save CAMs as .json files, and as .png (igraph)

save_CAMs_as_pictures = FALSE

if(save_CAMs_as_pictures){
  setwd("outputs")

setwd("savedCAMs_pre")
setwd("png")
### remove all files if there are any
if(length(list.files()) >= 1){
  file.remove(list.files())
  cat('\n!
      all former .png files have been deleted')
}

### if no participant ID was provided replace by randomly generated CAM ID

if(all(CAMfiles_pre[[3]]$participantCAM.x == "noID")){
  CAMfiles_pre[[3]]$participantCAM.x <- CAMfiles_pre[[3]]$CAM.x
}

### save as .json files, and as .png (igraph)
ids_CAMs <- unique(CAMfiles_pre[[3]]$participantCAM.x); length(ids_CAMs)


for(i in 1:length(ids_CAMs)){
  save_graphic(filename = paste0("CAM_", i, "_t1")) #  paste0(ids_CAMs[i]))
  CAM_igraph <- CAMdrawn_pre[[c(1:length(CAMdrawn_pre))[
    names(CAMdrawn_pre) == paste0(unique(CAMfiles_pre[[3]]$participantCAM.x)[i])]]]
  plot(CAM_igraph, edge.arrow.size = .7,
       layout=layout_nicely, vertex.frame.color="black", asp = .5, margin = -0.1,
       vertex.size = 10, vertex.label.cex = .9)
  dev.off()
}

setwd("../json")
### remove all files if there are any
if(length(list.files()) >= 1){
  file.remove(list.files())
  cat('\n!
      all former .json files have been deleted')
}
for(i in 1:length(raw_CAM_pre)){
  if(!is_empty(raw_CAM_pre[[i]]$nodes)){
    if(nrow(raw_CAM_pre[[i]]$nodes) > 5){
      write(toJSON(raw_CAM_pre[[i]], encoding = "UTF-8"),
            paste0(raw_CAM_pre[[i]]$idCAM, ".json"))
    }
  }
}
}

post

Load CAM data

setwd("outputs")
suppressMessages(read_file("secondCAMdata.txt") %>%
  # ... split it into lines ...
  str_split('\n') %>% first() %>%
    discard(function(x) x == '') %>%
    discard(function(x) x == '\r') %>%
  # ... filter empty rows ...
  discard(function(x) x == '')) -> dat_CAM_post

raw_CAM_post <- list()
for(i in 1:length(dat_CAM_post)){
  raw_CAM_post[[i]] <- jsonlite::fromJSON(txt = dat_CAM_post[[i]])
}

Create CAM files, draw CAMs and compute network indicators

########################################
# create CAM single files (nodes, connectors, merged)
########################################
CAMfiles_post <- create_CAMfiles(datCAM = raw_CAM_post, reDeleted = TRUE)
Nodes and connectors, which were deleted by participants were removed. 
 # deleted nodes:  123 
 # deleted connectors:  65
########################################
# draw CAMs
########################################
CAMdrawn_post <- draw_CAM(dat_merged = CAMfiles_post[[3]],
                     dat_nodes = CAMfiles_post[[1]],ids_CAMs = "all",
                     plot_CAM = FALSE,
                     useCoordinates = TRUE,
                     relvertexsize = 3,
                     reledgesize = 1)
processing 193 CAMs... 
[1] "== ids_CAMs in drawnCAM"
########################################
# draw CAMs
########################################
tmp_microIndicator <- c("Rettungsroboter", "sozialer Assistenzroboter", "Vorteile", "Nachteile")
networkIndicators_post <- compute_indicatorsCAM(drawn_CAM = CAMdrawn_post, 
                                           micro_degree = tmp_microIndicator, 
                                           micro_valence = tmp_microIndicator, 
                                           micro_centr_clo = tmp_microIndicator, 
                                           micro_transitivity = tmp_microIndicator, 
                                           largestClique = FALSE)


########################################
# wordlists
########################################
CAMwordlist_post <- create_wordlist(
  dat_nodes =  CAMfiles_post[[1]],
  dat_merged =  CAMfiles_post[[3]],
  order = "frequency",
  splitByValence = FALSE,
  comments = TRUE,
  raterSubsetWords = NULL,
  rater = FALSE
)
processing 193 CAMs... 
[1] "== ids_CAMs in drawnCAM"
DT::datatable(CAMwordlist_post, options = list(pageLength = 5)) 

save CAMs as .json files, and as .png (igraph)

save_CAMs_as_pictures = FALSE

if(save_CAMs_as_pictures){
  setwd("outputs")

setwd("savedCAMs_post")
setwd("png")
### remove all files if there are any
if(length(list.files()) >= 1){
  file.remove(list.files())
  cat('\n!
      all former .png files have been deleted')
}

### if no participant ID was provided replace by randomly generated CAM ID

if(all(CAMfiles_post[[3]]$participantCAM.x == "noID")){
  CAMfiles_post[[3]]$participantCAM.x <- CAMfiles_post[[3]]$CAM.x
}

### save as .json files, and as .png (igraph)
ids_CAMs <- unique(CAMfiles_post[[3]]$participantCAM.x); length(ids_CAMs)


for(i in 1:length(ids_CAMs)){
  save_graphic(filename = paste0("CAM_", i, "_t2")) #  paste0(ids_CAMs[i], "_t2"))
  CAM_igraph <- CAMdrawn_post[[c(1:length(CAMdrawn_post))[
    names(CAMdrawn_post) == paste0(unique(CAMfiles_post[[3]]$participantCAM.x)[i])]]]
  plot(CAM_igraph, edge.arrow.size = .7,
       layout=layout_nicely, vertex.frame.color="black", asp = .5, margin = -0.1,
       vertex.size = 10, vertex.label.cex = .9)
  dev.off()
}

setwd("../json")
### remove all files if there are any
if(length(list.files()) >= 1){
  file.remove(list.files())
  cat('\n!
      all former .json files have been deleted')
}
for(i in 1:length(raw_CAM_post)){
  if(!is_empty(raw_CAM_post[[i]]$nodes)){
    if(nrow(raw_CAM_post[[i]]$nodes) > 5){
      write(toJSON(raw_CAM_post[[i]], encoding = "UTF-8"),
            paste0(raw_CAM_post[[i]]$idCAM, ".json"))
    }
  }
}
}

analyze data

group comparisons

networkIndicators_pre$timepoint <- "pre"
networkIndicators_post$timepoint <- "post"



networkIndicators <- rbind(networkIndicators_pre, networkIndicators_post)

### add type robot
networkIndicators$typeRobot <- ifelse(test = !is.na(networkIndicators$valence_micro_Rettungsroboter), yes = "rescue robots", no = "socially assistive robots")
table(networkIndicators$typeRobot)

            rescue robots socially assistive robots 
                      176                       210 
### add ID
networkIndicators$ID <- c(1:(nrow(networkIndicators) / 2), 1:(nrow(networkIndicators) / 2))

########################################
# show which robot was on average perceived more positive (overall data set)
########################################
summary(networkIndicators$mean_valence_macro[!is.na(networkIndicators$valence_micro_Rettungsroboter)])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-0.5909  0.0000  0.2308  0.2942  0.5000  1.4167 
summary(networkIndicators$mean_valence_macro[!is.na(networkIndicators$valence_micro_sozialerAssistenzroboter)])
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
-2.28571 -0.18182  0.00000  0.05642  0.28571  1.50000 
########################################
# post - pre difference of robot -> average valence
########################################

############
# overall
############
### overall
hist(networkIndicators_post$mean_valence_macro - networkIndicators_pre$mean_valence_macro)

summary(networkIndicators_post$mean_valence_macro - networkIndicators_pre$mean_valence_macro)
     Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
-0.418269 -0.061785  0.008403  0.050405  0.159341  1.205128 
ggwithinstats(
  data = networkIndicators,
  x = timepoint,
  y = mean_valence_macro
)

table(networkIndicators$ID, networkIndicators$typeRobot)
     
      rescue robots socially assistive robots
  1               0                         2
  2               0                         2
  3               0                         2
  4               0                         2
  5               2                         0
  6               2                         0
  7               0                         2
  8               0                         2
  9               0                         2
  10              0                         2
  11              2                         0
  12              2                         0
  13              0                         2
  14              0                         2
  15              0                         2
  16              0                         2
  17              0                         2
  18              0                         2
  19              0                         2
  20              2                         0
  21              0                         2
  22              0                         2
  23              0                         2
  24              0                         2
  25              0                         2
  26              0                         2
  27              2                         0
  28              2                         0
  29              0                         2
  30              2                         0
  31              0                         2
  32              2                         0
  33              2                         0
  34              0                         2
  35              0                         2
  36              0                         2
  37              0                         2
  38              2                         0
  39              0                         2
  40              0                         2
  41              0                         2
  42              0                         2
  43              2                         0
  44              0                         2
  45              0                         2
  46              0                         2
  47              2                         0
  48              0                         2
  49              0                         2
  50              0                         2
  51              0                         2
  52              0                         2
  53              1                         1
  54              2                         0
  55              0                         2
  56              2                         0
  57              0                         2
  58              0                         2
  59              2                         0
  60              0                         2
  61              0                         2
  62              0                         2
  63              2                         0
  64              2                         0
  65              0                         2
  66              2                         0
  67              0                         2
  68              0                         2
  69              0                         2
  70              1                         1
  71              2                         0
  72              0                         2
  73              2                         0
  74              2                         0
  75              0                         2
  76              0                         2
  77              2                         0
  78              2                         0
  79              2                         0
  80              0                         2
  81              0                         2
  82              0                         2
  83              0                         2
  84              2                         0
  85              0                         2
  86              2                         0
  87              2                         0
  88              2                         0
  89              2                         0
  90              0                         2
  91              0                         2
  92              0                         2
  93              2                         0
  94              0                         2
  95              2                         0
  96              2                         0
  97              2                         0
  98              0                         2
  99              0                         2
  100             0                         2
  101             2                         0
  102             2                         0
  103             0                         2
  104             2                         0
  105             2                         0
  106             2                         0
  107             2                         0
  108             0                         2
  109             0                         2
  110             2                         0
  111             0                         2
  112             2                         0
  113             2                         0
  114             2                         0
  115             0                         2
  116             0                         2
  117             0                         2
  118             0                         2
  119             2                         0
  120             2                         0
  121             2                         0
  122             2                         0
  123             0                         2
  124             2                         0
  125             2                         0
  126             2                         0
  127             2                         0
  128             2                         0
  129             0                         2
  130             0                         2
  131             0                         2
  132             2                         0
  133             2                         0
  134             2                         0
  135             2                         0
  136             2                         0
  137             2                         0
  138             2                         0
  139             2                         0
  140             2                         0
  141             0                         2
  142             0                         2
  143             2                         0
  144             0                         2
  145             2                         0
  146             0                         2
  147             2                         0
  148             2                         0
  149             0                         2
  150             0                         2
  151             2                         0
  152             2                         0
  153             0                         2
  154             2                         0
  155             2                         0
  156             2                         0
  157             2                         0
  158             0                         2
  159             0                         2
  160             0                         2
  161             2                         0
  162             0                         2
  163             2                         0
  164             2                         0
  165             0                         2
  166             2                         0
  167             2                         0
  168             0                         2
  169             0                         2
  170             2                         0
  171             0                         2
  172             0                         2
  173             0                         2
  174             2                         0
  175             0                         2
  176             0                         2
  177             0                         2
  178             2                         0
  179             2                         0
  180             0                         2
  181             2                         0
  182             2                         0
  183             0                         2
  184             2                         0
  185             0                         2
  186             0                         2
  187             2                         0
  188             2                         0
  189             0                         2
  190             0                         2
  191             0                         2
  192             2                         0
  193             0                         2
############
# separated by robots - mean valence
############
# fit1 <- afex::aov_car(mean_valence_macro ~ timepoint*typeRobot + Error(ID / timepoint),
#                       data = networkIndicators)
# plot(CAMdrawn_pre[[53]])
# plot(CAMdrawn_post[[53]])
# plot(CAMdrawn_pre[[70]])
# plot(CAMdrawn_post[[70]])
networkIndicators_anova <- networkIndicators[!networkIndicators$ID %in% c(53, 70),]

fit1 <- afex::aov_car(mean_valence_macro ~ timepoint*typeRobot + Error(ID / timepoint),
                      data = networkIndicators_anova)
Converting to factor: typeRobot
Contrasts set to contr.sum for the following variables: typeRobot
fit1a <- afex::aov_ez(id = "ID", dv = "mean_valence_macro",
                      data = networkIndicators_anova, between=c("typeRobot"), within=c("timepoint"))
Converting to factor: typeRobot
Contrasts set to contr.sum for the following variables: typeRobot
# partical eta squared
anova(fit1, es = "pes")
Anova Table (Type 3 tests)

Response: mean_valence_macro
                    num Df den Df     MSE       F      pes    Pr(>F)    
typeRobot                1    189 0.38032 12.7898 0.063382 0.0004426 ***
timepoint                1    189 0.02047 11.0654 0.055309 0.0010568 ** 
typeRobot:timepoint      1    189 0.02047  1.7042 0.008936 0.1933314    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# generalized eta squared
fit1a # > identical results
Anova Table (Type 3 tests)

Response: mean_valence_macro
               Effect     df  MSE         F   ges p.value
1           typeRobot 1, 189 0.38 12.79 ***  .060   <.001
2           timepoint 1, 189 0.02  11.07 **  .003    .001
3 typeRobot:timepoint 1, 189 0.02      1.70 <.001    .193
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
dfvalcor <- data_summary(networkIndicators_anova, varname="mean_valence_macro",
                         groupnames=c("timepoint","typeRobot"))
Lade nötiges Paket: plyr
------------------------------------------------------------------------------
You have loaded plyr after dplyr - this is likely to cause problems.
If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
library(plyr); library(dplyr)
------------------------------------------------------------------------------

Attache Paket: 'plyr'
Die folgenden Objekte sind maskiert von 'package:dplyr':

    arrange, count, desc, failwith, id, mutate, rename, summarise,
    summarize
Das folgende Objekt ist maskiert 'package:purrr':

    compact
p <- ggplot(dfvalcor, aes(x=timepoint, y=mean_valence_macro, fill=typeRobot)) +
  geom_bar(stat="identity", color="black",
           position=position_dodge()) +
  geom_errorbar(aes(ymin=mean_valence_macro-se, ymax=mean_valence_macro+se), width=.2,
                position=position_dodge(.9)) + ggplot_theme + ylab(label = "average emotional evaluation")
print(p)

############
# separated by robots - number of concepts
############
fit1 <- afex::aov_car(num_nodes_macro ~ timepoint*typeRobot + Error(ID / timepoint),
                      data = networkIndicators_anova)
Converting to factor: typeRobot
Contrasts set to contr.sum for the following variables: typeRobot
fit1a <- afex::aov_ez(id = "ID", dv = "num_nodes_macro",
                      data = networkIndicators_anova, between=c("typeRobot"), within=c("timepoint"))
Converting to factor: typeRobot
Contrasts set to contr.sum for the following variables: typeRobot
# partical eta squared
anova(fit1, es = "pes")
Anova Table (Type 3 tests)

Response: num_nodes_macro
                    num Df den Df     MSE        F     pes Pr(>F)    
typeRobot                1    189 23.7386   0.1247 0.00066 0.7244    
timepoint                1    189  2.7566 161.2091 0.46032 <2e-16 ***
typeRobot:timepoint      1    189  2.7566   0.8376 0.00441 0.3612    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# generalized eta squared
fit1a # > identical results
Anova Table (Type 3 tests)

Response: num_nodes_macro
               Effect     df   MSE          F   ges p.value
1           typeRobot 1, 189 23.74       0.12 <.001    .724
2           timepoint 1, 189  2.76 161.21 ***  .082   <.001
3 typeRobot:timepoint 1, 189  2.76       0.84 <.001    .361
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1
dfvalcor <- data_summary(networkIndicators_anova, varname="num_nodes_macro",
                         groupnames=c("timepoint","typeRobot"))
p <- ggplot(dfvalcor, aes(x=timepoint, y=num_nodes_macro, fill=typeRobot)) +
  geom_bar(stat="identity", color="black",
           position=position_dodge()) +
  geom_errorbar(aes(ymin=num_nodes_macro-se, ymax=num_nodes_macro+se), width=.2,
                position=position_dodge(.9)) + ggplot_theme + ylab(label = "number of drawn concepts")
print(p)

########################################
# post - pre difference of robot -> average number of concepts
########################################
ggwithinstats(
  data = networkIndicators,
  x = timepoint,
  y = num_nodes_macro
)

open text answers

questionnaire_secondPostCAM$meanDifferencesCAMs <- round(x = networkIndicators_post$mean_valence_macro - networkIndicators_pre$mean_valence_macro, digits = 2)
DT::datatable(questionnaire_secondPostCAM[,c("meanDifferencesCAMs", "ans1", "feedback_critic")], options = list(pageLength = 5)) 

check questions

###
c("63b87d2c9edd47ad702413a1", "5edc8e2eaa0f2295a0fcef85", "6529483ef2abe408d574860a") %in% questionnaire_preCAM$PROLIFIC_PID
[1] TRUE TRUE TRUE
###

tmpID <- questionnaire_preCAM$ID[questionnaire_preCAM$PROLIFIC_PID == "63b87d2c9edd47ad702413a1"]
plot(CAMdrawn_pre[[tmpID]])

plot(CAMdrawn_post[[tmpID]])

tmpID <- questionnaire_preCAM$ID[questionnaire_preCAM$PROLIFIC_PID == "5edc8e2eaa0f2295a0fcef85"]
plot(CAMdrawn_pre[[tmpID]])

plot(CAMdrawn_post[[tmpID]])

tmpID <- questionnaire_preCAM$ID[questionnaire_preCAM$PROLIFIC_PID == "6529483ef2abe408d574860a"]
plot(CAMdrawn_pre[[tmpID]])

plot(CAMdrawn_post[[tmpID]])