[1] "create_wordlist - use raw words"
[1] 0
[1] 3113
[1] "temporarily suffixes are added, because not all words have been summarized"
processing 227 CAMs...
[1] "== participantCAM in drawnCAM"
save_CAMs_as_pictures =FALSEif(save_CAMs_as_pictures){setwd("outputs")setwd("savedCAMs_pre")setwd("png")### remove all files if there are anyif(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 IDif(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 in1: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 anyif(length(list.files()) >=1){file.remove(list.files())cat('\n! all former .json files have been deleted')}for(i in1: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_postraw_CAM_post <-list()for(i in1:length(dat_CAM_post)){ raw_CAM_post[[i]] <- jsonlite::fromJSON(txt = dat_CAM_post[[i]])}
Create CAM files, draw CAMs and compute network indicators
[1] "create_wordlist - use raw words"
[1] 0
[1] 3571
[1] "temporarily suffixes are added, because not all words have been summarized"
processing 227 CAMs...
[1] "== participantCAM in drawnCAM"
save_CAMs_as_pictures =FALSEif(save_CAMs_as_pictures){setwd("outputs")setwd("savedCAMs_post")setwd("png")### remove all files if there are anyif(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 IDif(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 in1: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 anyif(length(list.files()) >=1){file.remove(list.files())cat('\n! all former .json files have been deleted')}for(i in1: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")) } }}}
identify types of changes (delta CAM)
################# set A, B, C, D types################# !!! i = 215if (all(unique(CAMfiles_pre[[1]]$participantCAM) ==unique(CAMfiles_post[[1]]$participantCAM))) { vec_type <-c() error <-0 verbose =FALSE## list_newWords_text <-list() list_newWords_value <-list() list_ids <-list() h =1for (i in1:length(unique(CAMfiles_pre[[1]]$participantCAM))) { praeCAM <- CAMfiles_pre[[1]][CAMfiles_pre[[1]]$participantCAM ==unique(CAMfiles_pre[[1]]$participantCAM)[i],] postCAM <- CAMfiles_post[[1]][CAMfiles_post[[1]]$participantCAM ==unique(CAMfiles_post[[1]]$participantCAM)[i],]## to test:# praeCAM$text %in% postCAM$text# postCAM$text %in% praeCAM$text# length(praeCAM$text)# length(postCAM$text)# praeCAM$text# postCAM$text## Typ Aif (all(postCAM$text %in% praeCAM$text) &length(postCAM$text) <length(praeCAM$text)) { vec_type[i] <-"A"if (verbose) {cat("\n i:", i, "type:", vec_type[i], "\n") } error = error +1 }## Typ Bif (all(praeCAM$text %in% postCAM$text) &length(postCAM$text) >length(praeCAM$text)) { vec_type[i] <-"B"if (verbose) {cat("\n i:", i, "type:", vec_type[i], "\n") } error = error +1## get words and values list_newWords_text[[h]] <- postCAM$text[!postCAM$text %in% praeCAM$text] list_newWords_value[[h]] <- postCAM$value[!postCAM$text %in% praeCAM$text] list_ids[[h]] <-rep(unique(CAMfiles_pre[[1]]$participantCAM)[i], times =length(list_newWords_value[[h]])) h = h +1 }## Typ Cif (all(praeCAM$text %in% postCAM$text) &all(postCAM$text %in% praeCAM$text)) { vec_type[i] <-"C"if (verbose) {cat("\n i:", i, "type:", vec_type[i], "\n") } error = error +1 }## Typ D# smaller > pr? UE post, post UE pr?if (sum(praeCAM$text %in% postCAM$text) <length(praeCAM$text) &sum(postCAM$text %in% praeCAM$text) <length(postCAM$text)) { vec_type[i] <-"D"if (verbose) {cat("\n i:", i, "type:", vec_type[i], "\n") } error = error +1 }if (error >1) {print("ERROR in (not exclusive logical condition)", i)stop("check your data and adjust this function") } error =0 }}table(vec_type)
vec_type
A B C D
2 142 38 44
barplot(table(unlist(list_newWords_value)))
# sort(table(unlist(list_newWords_text)))dat_newWords <-data.frame(participantCAM =unlist(list_ids), text =unlist(list_newWords_text), value =unlist(list_newWords_value))DT::datatable(dat_newWords, options =list(pageLength =5))
tmp <- dat_newWords %>%group_by(participantCAM) %>% dplyr::summarise(mean =mean(value), n =n())tmp2 <-data.frame(typeRobot = questionnaire$choosen_Robot[questionnaire$PROLIFIC_PID %in% dat_newWords$participantCAM], participantCAM = tmp$participantCAM, mean = tmp$mean, n = tmp$n)DT::datatable(tmp2, options =list(pageLength =5))
boxplot(tmp2$mean ~ tmp2$typeRobot)
boxplot(tmp2$n ~ tmp2$typeRobot)
analyze data
describe data set
feedback to the study
Question: Haben Sie Feedback oder Kritik an der Online-Studie?
### add IDnetworkIndicators$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.6154 0.0000 0.2426 0.2929 0.5000 1.5556
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############### overallhist(networkIndicators_post$mean_valence_macro - networkIndicators_pre$mean_valence_macro)
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)
######################################### post - pre difference of robot -> average number of concepts########################################ggwithinstats(data = networkIndicators,x = timepoint,y = num_nodes_macro)
open text answers (adaptive question)
Question: Ihre angepasste Mind-Map hatte eine durchschnittliche emotionale Bewertung von XXX, diese war im Vergleich zu ihrer anfangs gezeichneten Mind-Map (durchschnittliche emotionale Bewertung von XXX) XXX. Bitte erklären Sie, warum Sie diese XXX wahrgenommen haben: