Combine CAM files, clean data

Author

Julius Fenn, Lars Kreuznacht

Notes

Remark:

## global variables
save_CAMs_as_pictures = FALSE
save_CAMs_as_pictures_combined = FALSE # cannot get it work!

prepare raw data

load packages, raw data, functions

# sets the directory of location of this script as the current directory
# setwd(dirname(rstudioapi::getSourceEditorContext()$path))

########################################
# load packages
########################################
require(pacman)
p_load('tidyverse', 'jsonlite', 'magrittr', 'xlsx',
       'stargazer', 'psych', 'jtools', 'DT', 'ggstatsplot', 
       'lavaan','ggplot2','report', 'sjPlot', 'car',
       'regsem', 'MplusAutomation', 'igraph',
       'vroom')


########################################
# load data files
########################################
setwd("data")
# dir()


### load CAM files
# individual
suppressMessages(read_file("cam_ind.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_individual

raw_CAM_individual <- list()
for(i in 1:length(dat_CAM_individual)){
  raw_CAM_individual[[i]] <- jsonlite::fromJSON(txt = dat_CAM_individual[[i]])
    raw_CAM_individual[[i]]$connectors$isBidirectional <- FALSE
}
# rm(dat_CAM_individual)

# group
suppressMessages(read_file("cam_group.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_group

raw_CAM_group <- list()
for(i in 1:length(dat_CAM_group)){
  raw_CAM_group[[i]] <- jsonlite::fromJSON(txt = dat_CAM_group[[i]])
  raw_CAM_group[[i]]$connectors$isBidirectional <- FALSE
}
# rm(dat_CAM_group)

data.frame(dat_CAM_group)


## load file for manually overwriting words
dat_SosciSurvey <- read.delim(
  file= "rdata_test399712_2024-04-22_16-00.csv", encoding="UTF-8", fileEncoding="UTF-8",
  header = FALSE, sep = "\t", quote = "\"",
  dec = ".", row.names = NULL,
  col.names = c(
    "CASE","SERIAL","REF","QUESTNNR","MODE","STARTED","AB01","BD01_01","BD02",
    "BD04","BD04_02","BD06","BD07","GE01_01","GE01_02","GE02","GP_01","GP_02",
    "GP_03","GP_04","GP_05","GP_06","GP_07","GP_08","GP_09","GP_10","GP_11","GP_12",
    "GP_13","GP_14","GP_15","GP_16","IC01","PC01_05","PC01_08","PC01_09","PC01_12",
    "PC01_06","PC01_11","PC01_04","PC01_03","PC06_01","PC06_02","PC02_01","PC02_02",
    "PC02_03","PC02_08","PC02_04","PC02_05","PC02_06","PC02_07","PC03_01","PC03_02",
    "PC03_04","PC03_06","PC03_07","PC03_08","PC03_09","PC03_10","PC03_11","PC0_GN",
    "PO01","PO01_07","SO01_01","TE01_RV1","TE02","TE02_02","TIME001","TIME002",
    "TIME003","TIME004","TIME005","TIME006","TIME007","TIME008","TIME009","TIME010",
    "TIME011","TIME012","TIME013","TIME014","TIME015","TIME016","TIME017","TIME018",
    "TIME019","TIME020","TIME021","TIME022","TIME023","TIME024","TIME025","TIME026",
    "TIME027","TIME028","TIME029","TIME_SUM","MAILSENT","LASTDATA","FINISHED",
    "Q_VIEWER","LASTPAGE","MAXPAGE","MISSING","MISSREL","TIME_RSI"
  ),
  as.is = TRUE,
  colClasses = c(
    CASE="numeric", SERIAL="character", REF="character", QUESTNNR="character",
    MODE="factor", STARTED="POSIXct", AB01="numeric", BD01_01="numeric",
    BD02="numeric", BD04="numeric", BD04_02="character", BD06="numeric",
    BD07="numeric", GE01_01="numeric", GE01_02="numeric", GE02="numeric",
    GP_01="numeric", GP_02="numeric", GP_03="numeric", GP_04="numeric",
    GP_05="numeric", GP_06="numeric", GP_07="numeric", GP_08="numeric",
    GP_09="numeric", GP_10="numeric", GP_11="numeric", GP_12="numeric",
    GP_13="numeric", GP_14="numeric", GP_15="numeric", GP_16="numeric",
    IC01="numeric", PC01_05="numeric", PC01_08="numeric", PC01_09="numeric",
    PC01_12="numeric", PC01_06="numeric", PC01_11="numeric", PC01_04="numeric",
    PC01_03="numeric", PC06_01="numeric", PC06_02="numeric", PC02_01="numeric",
    PC02_02="numeric", PC02_03="numeric", PC02_08="numeric", PC02_04="numeric",
    PC02_05="numeric", PC02_06="numeric", PC02_07="numeric", PC03_01="numeric",
    PC03_02="numeric", PC03_04="numeric", PC03_06="numeric", PC03_07="numeric",
    PC03_08="numeric", PC03_09="numeric", PC03_10="numeric", PC03_11="numeric",
    PC0_GN="numeric", PO01="numeric", PO01_07="character", SO01_01="character",
    TE01_RV1="character", TE02="numeric", TE02_02="character",
    TIME001="integer", TIME002="integer", TIME003="integer", TIME004="integer",
    TIME005="integer", TIME006="integer", TIME007="integer", TIME008="integer",
    TIME009="integer", TIME010="integer", TIME011="integer", TIME012="integer",
    TIME013="integer", TIME014="integer", TIME015="integer", TIME016="integer",
    TIME017="integer", TIME018="integer", TIME019="integer", TIME020="integer",
    TIME021="integer", TIME022="integer", TIME023="integer", TIME024="integer",
    TIME025="integer", TIME026="integer", TIME027="integer", TIME028="integer",
    TIME029="integer", TIME_SUM="integer", MAILSENT="POSIXct",
    LASTDATA="POSIXct", FINISHED="logical", Q_VIEWER="logical",
    LASTPAGE="numeric", MAXPAGE="numeric", MISSING="numeric", MISSREL="numeric",
    TIME_RSI="numeric"
  ),
  skip = 1,
  check.names = TRUE, fill = TRUE,
  strip.white = FALSE, blank.lines.skip = TRUE,
  comment.char = "",
  na.strings = ""
)
########################################
# load functions
########################################
 print(getwd())
setwd("../functions")
for(i in 1:length(dir())){
 print(dir()[i])
 source(dir()[i], encoding = "utf-8")
}


setwd("../functions_CAMapp")
for(i in 1:length(dir())){
  # print(dir()[i])
  source(dir()[i], encoding = "utf-8")
}
rm(i)

set up CAM data

ceck for CAM ids

all CAMs have unique IDs

# German
for(i in 1:length(raw_CAM_group)){
  # print(raw_CAM_group[[i]]$creator)
}

# English
for(i in 1:length(raw_CAM_individual)){
  # print(raw_CAM_individual[[i]]$creator)
}

set up CAM data individual

Create CAM files, draw CAMs and compute network indicators

### create CAM single files (nodes, connectors, merged)
CAMfiles_individual <- create_CAMfiles(datCAM = raw_CAM_individual, reDeleted = TRUE)
Nodes and connectors, which were deleted by participants were removed. 
 # deleted nodes:  82 
 # deleted connectors:  22
## remove empty concepts:
CAMfiles_individual[[1]]$text[nchar(CAMfiles_individual[[1]]$text) < 2]
character(0)
# tmp_ids <- CAMfiles_individual[[1]]$id[nchar(CAMfiles_individual[[1]]$text) < 2]
# table(CAMfiles_individual[[1]]$isActive[CAMfiles_individual[[1]]$id %in% tmp_ids])
# CAMfiles_individual[[1]] <- CAMfiles_individual[[1]][!CAMfiles_individual[[1]]$id %in% tmp_ids,]


### draw CAMs
CAMdrawn_individual <- draw_CAM(dat_merged = CAMfiles_individual[[3]],
                     dat_nodes = CAMfiles_individual[[1]],ids_CAMs = "all",
                     plot_CAM = FALSE,
                     useCoordinates = TRUE,
                     relvertexsize = 3,
                     reledgesize = 1)
processing 34 CAMs... 
Warning: `graph.data.frame()` was deprecated in igraph 2.0.0.
ℹ Please use `graph_from_data_frame()` instead.
[1] "== participantCAM in drawnCAM"
## check for non reasonable words
for(i in 1:length(CAMdrawn_individual)){
  if(any(nchar(V(CAMdrawn_individual[[i]])$label) < 3)){
    print(V(CAMdrawn_individual[[i]])$label)
  }
}

### network indicators
tmp_microIndicator <- c("Wirtschaftswachstum", "Ökologische Nachhaltigkeit") # pre-defined concepts
networkIndicators_individual <- compute_indicatorsCAM(drawn_CAM = CAMdrawn_individual, 
                                           micro_degree = tmp_microIndicator, 
                                           micro_valence = tmp_microIndicator, 
                                           micro_centr_clo = tmp_microIndicator, 
                                           micro_transitivity = tmp_microIndicator, 
                                           largestClique = FALSE)
Warning: `graph.density()` was deprecated in igraph 2.0.0.
ℹ Please use `edge_density()` instead.
Warning: The `types1` argument of `assortativity()` is deprecated as of igraph 1.6.0.
ℹ Please use the `values` argument instead.
Warning: `assortativity.degree()` was deprecated in igraph 2.0.0.
ℹ Please use `assortativity_degree()` instead.
## check for CAMs who have not changed valence
tmp_ids <- networkIndicators_individual$CAM_ID[is.na(networkIndicators_individual$assortativity_valence_macro)]
for(i in tmp_ids){
    plot(CAMdrawn_individual[[i]], edge.arrow.size = .7,
       layout=layout_nicely, vertex.frame.color="black", asp = .5, margin = -0.1,
       vertex.size = 10, vertex.label.cex = .9)
}


### wordlist
CAMwordlist_individual <- create_wordlist(
  dat_nodes =  CAMfiles_individual[[1]],
  dat_merged =  CAMfiles_individual[[3]],
  useSummarized = TRUE,
  order = "frequency",
  splitByValence = FALSE,
  comments = TRUE,
  raterSubsetWords = NULL,
  rater = FALSE
)
[1] "create_wordlist - use raw words"
[1] 0
[1] 456
[1] "temporarily suffixes are added, because not all words have been summarized"
processing 34 CAMs... 
[1] "== participantCAM in drawnCAM"
DT::datatable(CAMwordlist_individual, options = list(pageLength = 5)) 

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

if(save_CAMs_as_pictures){
setwd("outputs")

setwd("savedCAMs_individual")
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_individual[[3]]$participantCAM.x == "noID")){
  CAMfiles_individual[[3]]$participantCAM.x <- CAMfiles_individual[[3]]$CAM.x
}

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


for(i in 1:length(ids_CAMs)){
  save_graphic(filename = paste0("individual_", ids_CAMs[i])) #  paste0(ids_CAMs[i]))
  CAM_igraph <- CAMdrawn_individual[[c(1:length(CAMdrawn_individual))[
    names(CAMdrawn_individual) == paste0(unique(CAMfiles_individual[[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_individual)){
  if(!is_empty(raw_CAM_individual[[i]]$nodes)){
    if(nrow(raw_CAM_individual[[i]]$nodes) > 5){
      write(toJSON(raw_CAM_individual[[i]], encoding = "UTF-8"),
            paste0(raw_CAM_individual[[i]]$idCAM, ".json"))
    }
  }
}
}

set up CAM data group

Create CAM files, draw CAMs and compute network indicators

### create CAM single files (nodes, connectors, merged)
CAMfiles_group <- create_CAMfiles(datCAM = raw_CAM_group, reDeleted = TRUE)
Nodes and connectors, which were deleted by participants were removed. 
 # deleted nodes:  21 
 # deleted connectors:  10
## remove empty concepts:
CAMfiles_group[[1]]$text[nchar(CAMfiles_group[[1]]$text) < 2]
character(0)
# tmp_ids <- CAMfiles_group[[1]]$id[nchar(CAMfiles_group[[1]]$text) < 2]
# table(CAMfiles_group[[1]]$isActive[CAMfiles_group[[1]]$id %in% tmp_ids])
# CAMfiles_group[[1]] <- CAMfiles_group[[1]][!CAMfiles_group[[1]]$id %in% tmp_ids,]


### draw CAMs
CAMdrawn_group <- draw_CAM(dat_merged = CAMfiles_group[[3]],
                     dat_nodes = CAMfiles_group[[1]],ids_CAMs = "all",
                     plot_CAM = FALSE,
                     useCoordinates = TRUE,
                     relvertexsize = 3,
                     reledgesize = 1)
processing 11 CAMs... 
[1] "== participantCAM in drawnCAM"
## check for non reasonable words
for(i in 1:length(CAMdrawn_group)){
  if(any(nchar(V(CAMdrawn_group[[i]])$label) < 3)){
    print(V(CAMdrawn_group[[i]])$label)
  }
}

### network indicators
tmp_microIndicator <- c("Wirtschaftswachstum", "Ökologische Nachhaltigkeit") # pre-defined concepts
networkIndicators_group <- compute_indicatorsCAM(drawn_CAM = CAMdrawn_group, 
                                           micro_degree = tmp_microIndicator, 
                                           micro_valence = tmp_microIndicator, 
                                           micro_centr_clo = tmp_microIndicator, 
                                           micro_transitivity = tmp_microIndicator, 
                                           largestClique = FALSE)


## check for CAMs who have not changed valence
tmp_ids <- networkIndicators_group$CAM_ID[is.na(networkIndicators_group$assortativity_valence_macro)]
for(i in tmp_ids){
    plot(CAMdrawn_group[[i]], edge.arrow.size = .7,
       layout=layout_nicely, vertex.frame.color="black", asp = .5, margin = -0.1,
       vertex.size = 10, vertex.label.cex = .9)
}

### wordlist
CAMwordlist_group <- create_wordlist(
  dat_nodes =  CAMfiles_group[[1]],
  dat_merged =  CAMfiles_group[[3]],
  useSummarized = TRUE,
  order = "frequency",
  splitByValence = FALSE,
  comments = TRUE,
  raterSubsetWords = NULL,
  rater = FALSE
)
[1] "create_wordlist - use raw words"
[1] 0
[1] 180
[1] "temporarily suffixes are added, because not all words have been summarized"
processing 11 CAMs... 
[1] "== participantCAM in drawnCAM"
DT::datatable(CAMwordlist_group, options = list(pageLength = 5)) 

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

if(save_CAMs_as_pictures){
setwd("outputs")

setwd("savedCAMs_group")
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_group[[3]]$participantCAM.x == "noID")){
  CAMfiles_group[[3]]$participantCAM.x <- CAMfiles_group[[3]]$CAM.x
}

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


for(i in 1:length(ids_CAMs)){
  save_graphic(filename = paste0("group_", ids_CAMs[i])) #  paste0(ids_CAMs[i]))
  CAM_igraph <- CAMdrawn_group[[c(1:length(CAMdrawn_group))[
    names(CAMdrawn_group) == paste0(unique(CAMfiles_group[[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_group)){
  if(!is_empty(raw_CAM_group[[i]]$nodes)){
    if(nrow(raw_CAM_group[[i]]$nodes) > 5){
      write(toJSON(raw_CAM_group[[i]], encoding = "UTF-8"),
            paste0(raw_CAM_group[[i]]$idCAM, ".json"))
    }
  }
}
}

merge all CAM files

### save CAMs
setwd("outputs/data CAMs")

writeLines("", "CAMdata_IndGroup.txt") # create file
text_connection <- file("CAMdata_IndGroup.txt", "a") # open connection to append


vec_ids <- c(); h = 1

## for individual CAMs
for(i in 1:length(raw_CAM_individual)){
    if(!is.null(raw_CAM_individual[[i]]$creator) && raw_CAM_individual[[i]]$creator %in% unique(dat_SosciSurvey$CASE)){
    vec_ids[h] <- raw_CAM_individual[[i]]$creator
    h = h + 1
    
    raw_CAM_individual[[i]]$creator <- paste0("individual_", raw_CAM_individual[[i]]$creator) ## overwrite ID
    writeLines(jsonlite::toJSON(x =  raw_CAM_individual[[i]]), text_connection)
  }
}


## for survey_t12 - t2
for(i in 1:length(raw_CAM_group)){
    if(!is.null(raw_CAM_group[[i]]$creator) && raw_CAM_group[[i]]$creator %in% unique(dat_SosciSurvey$CASE)){
    vec_ids[h] <- raw_CAM_group[[i]]$creator
    h = h + 1
    
        raw_CAM_group[[i]]$creator <- paste0("group_", raw_CAM_group[[i]]$creator) ## overwrite ID

    writeLines(jsonlite::toJSON(x =  raw_CAM_group[[i]]), text_connection)
  }
}



close(text_connection)



if(all(vec_ids %in% dat_SosciSurvey$CASE)){
  print("all CAMs saved")
}
[1] "all CAMs saved"

set up Sosci Survey data

prepare data

row.names(dat_SosciSurvey) = dat_SosciSurvey$CASE


attr(dat_SosciSurvey, "project") = "test399712"
attr(dat_SosciSurvey, "description") = "Master_CAM_01"
attr(dat_SosciSurvey, "date") = "2024-04-22 16:00:16"
attr(dat_SosciSurvey, "server") = "https://www.soscisurvey.de"

# Variable und Value Labels
dat_SosciSurvey$AB01 = factor(dat_SosciSurvey$AB01, levels=c("1","2","3","4","5","6","7","8","9","10","11","12","-9"), labels=c("Kein Schulabschluss","Hauptschulabschluss","Realschule (Mittlere Reife)","Gymnasium (Abitur)","Abgeschlossene Ausbildung","Fachhochschulabschluss","Meister*in","Hochschule (Bachelor)","Hochschule (Master)","Hochschule (Promotion)","Andere","Das möchte ich nicht angeben","[NA] nicht beantwortet"), ordered=FALSE)
dat_SosciSurvey$BD02 = factor(dat_SosciSurvey$BD02, levels=c("1","2","3","4","5","-9"), labels=c("Weiblich","Männlich","Divers","<4>","Das möchte ich nicht angeben","[NA] nicht beantwortet"), ordered=FALSE)
dat_SosciSurvey$BD04 = factor(dat_SosciSurvey$BD04, levels=c("1","2","3","-9"), labels=c("Ja","Nein, sondern","Das möchte ich nicht angeben","[NA] nicht beantwortet"), ordered=FALSE)
dat_SosciSurvey$BD06 = factor(dat_SosciSurvey$BD06, levels=c("1","2","3","-9"), labels=c("Ja, aktuell im Bachelor-Studium.","Ja, aktuell im Master-Studium.","Nein.","[NA] nicht beantwortet"), ordered=FALSE)
dat_SosciSurvey$BD07 = factor(dat_SosciSurvey$BD07, levels=c("1","2","-9"), labels=c("Ja","Nein","[NA] nicht beantwortet"), ordered=FALSE)
dat_SosciSurvey$GE02 = factor(dat_SosciSurvey$GE02, levels=c("1","2","3","4","-9"), labels=c("weiteres Wirtschaftswachstum verfolgen trotz der damit verbundenen Umweltfolgen.","weiteres Wirtschaftswachstum verfolgen. Es gibt viele Wege, um Wirtschaftswachstum mit umweltbezogener Nachhaltigkeit kompatibel zu machen.","Wirtschaftswachstum als politisches Ziel ignorieren, d.h. komplett neutral bezüglich Wachstum sein. Dies wird die Bandbreite politischer Maßnahmen erweitern, um Ziele des Wohlstands und der umweltbezogenen Nachhaltigkeit zu verbinden.","aufhören, Wirtschaftswachstum zu verfolgen. Produktion und Konsum müssen auf gerechte Weise reduziert werden, um umweltbezogene Nachhaltigkeit zu erreichen.","[NA] nicht beantwortet"), ordered=FALSE)
dat_SosciSurvey$IC01 = factor(dat_SosciSurvey$IC01, levels=c("1","2","-9"), labels=c("Hiermit versichere ich, dass ich die oben beschriebenen Teilnahmeinformationen verstanden habe und mit den genannten Teilnahmebedingungen einverstanden bin.","Ich bin mit den genannten Teilnahmebedingungen nicht einverstanden. (Führt zum Abbruch der Studie)","[NA] nicht beantwortet"), ordered=FALSE)
dat_SosciSurvey$PO01 = factor(dat_SosciSurvey$PO01, levels=c("1","2","3","4","5","6","7","8","-9"), labels=c("AfD","CDU/CSU","Die Linke","FDP","Bündnis 90/Die Grünen","SPD","Andere","Ich würde nicht wählen","[NA] nicht beantwortet"), ordered=FALSE)
dat_SosciSurvey$TE02 = factor(dat_SosciSurvey$TE02, levels=c("1","2","-9"), labels=c("Nein","Ja, und zwar","[NA] nicht beantwortet"), ordered=FALSE)
attr(dat_SosciSurvey$GE01_01,"1") = "1 - überhaupt nicht informiert"
attr(dat_SosciSurvey$GE01_01,"2") = "[-2-]"
attr(dat_SosciSurvey$GE01_01,"3") = "[-3-]"
attr(dat_SosciSurvey$GE01_01,"4") = "[-4-]"
attr(dat_SosciSurvey$GE01_01,"5") = "[-5-]"
attr(dat_SosciSurvey$GE01_01,"6") = "[-6-]"
attr(dat_SosciSurvey$GE01_01,"7") = "7 - sehr gut informiert"
attr(dat_SosciSurvey$GE01_02,"1") = "1 - überhaupt nicht informiert"
attr(dat_SosciSurvey$GE01_02,"2") = "[-2-]"
attr(dat_SosciSurvey$GE01_02,"3") = "[-3-]"
attr(dat_SosciSurvey$GE01_02,"4") = "[-4-]"
attr(dat_SosciSurvey$GE01_02,"5") = "[-5-]"
attr(dat_SosciSurvey$GE01_02,"6") = "[-6-]"
attr(dat_SosciSurvey$GE01_02,"7") = "7 - sehr gut informiert"
attr(dat_SosciSurvey$GP_01,"1") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_01,"2") = "Stimme zu"
attr(dat_SosciSurvey$GP_01,"3") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_01,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_01,"5") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_01,"6") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_01,"7") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_02,"1") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_02,"2") = "Stimme zu"
attr(dat_SosciSurvey$GP_02,"3") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_02,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_02,"5") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_02,"6") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_02,"7") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_03,"1") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_03,"2") = "Stimme zu"
attr(dat_SosciSurvey$GP_03,"3") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_03,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_03,"5") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_03,"6") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_03,"7") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_04,"1") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_04,"2") = "Stimme zu"
attr(dat_SosciSurvey$GP_04,"3") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_04,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_04,"5") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_04,"6") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_04,"7") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_05,"1") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_05,"2") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_05,"3") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_05,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_05,"5") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_05,"6") = "Stimme zu"
attr(dat_SosciSurvey$GP_05,"7") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_06,"1") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_06,"2") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_06,"3") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_06,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_06,"5") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_06,"6") = "Stimme zu"
attr(dat_SosciSurvey$GP_06,"7") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_07,"1") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_07,"2") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_07,"3") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_07,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_07,"5") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_07,"6") = "Stimme zu"
attr(dat_SosciSurvey$GP_07,"7") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_08,"1") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_08,"2") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_08,"3") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_08,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_08,"5") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_08,"6") = "Stimme zu"
attr(dat_SosciSurvey$GP_08,"7") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_09,"1") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_09,"2") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_09,"3") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_09,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_09,"5") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_09,"6") = "Stimme zu"
attr(dat_SosciSurvey$GP_09,"7") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_10,"1") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_10,"2") = "Stimme zu"
attr(dat_SosciSurvey$GP_10,"3") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_10,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_10,"5") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_10,"6") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_10,"7") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_11,"1") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_11,"2") = "Stimme zu"
attr(dat_SosciSurvey$GP_11,"3") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_11,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_11,"5") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_11,"6") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_11,"7") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_12,"1") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_12,"2") = "Stimme zu"
attr(dat_SosciSurvey$GP_12,"3") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_12,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_12,"5") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_12,"6") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_12,"7") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_13,"1") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_13,"2") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_13,"3") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_13,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_13,"5") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_13,"6") = "Stimme zu"
attr(dat_SosciSurvey$GP_13,"7") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_14,"1") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_14,"2") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_14,"3") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_14,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_14,"5") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_14,"6") = "Stimme zu"
attr(dat_SosciSurvey$GP_14,"7") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_15,"1") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_15,"2") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_15,"3") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_15,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_15,"5") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_15,"6") = "Stimme zu"
attr(dat_SosciSurvey$GP_15,"7") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$GP_16,"1") = "Stimme überhaput nicht zu"
attr(dat_SosciSurvey$GP_16,"2") = "Stimme nicht zu"
attr(dat_SosciSurvey$GP_16,"3") = "Stimme eher nicht zu"
attr(dat_SosciSurvey$GP_16,"4") = "Stimme weder zu noch nicht zu"
attr(dat_SosciSurvey$GP_16,"5") = "Stimme eher zu"
attr(dat_SosciSurvey$GP_16,"6") = "Stimme zu"
attr(dat_SosciSurvey$GP_16,"7") = "Stimme voll und ganz zu"
attr(dat_SosciSurvey$PC01_05,"1") = "gar nicht"
attr(dat_SosciSurvey$PC01_05,"2") = "wenig"
attr(dat_SosciSurvey$PC01_05,"3") = "mittelmäßig"
attr(dat_SosciSurvey$PC01_05,"4") = "überwiegend"
attr(dat_SosciSurvey$PC01_05,"5") = "völlig"
attr(dat_SosciSurvey$PC01_08,"1") = "gar nicht"
attr(dat_SosciSurvey$PC01_08,"2") = "wenig"
attr(dat_SosciSurvey$PC01_08,"3") = "mittelmäßig"
attr(dat_SosciSurvey$PC01_08,"4") = "überwiegend"
attr(dat_SosciSurvey$PC01_08,"5") = "völlig"
attr(dat_SosciSurvey$PC01_09,"1") = "gar nicht"
attr(dat_SosciSurvey$PC01_09,"2") = "wenig"
attr(dat_SosciSurvey$PC01_09,"3") = "mittelmäßig"
attr(dat_SosciSurvey$PC01_09,"4") = "überwiegend"
attr(dat_SosciSurvey$PC01_09,"5") = "völlig"
attr(dat_SosciSurvey$PC01_12,"1") = "gar nicht"
attr(dat_SosciSurvey$PC01_12,"2") = "wenig"
attr(dat_SosciSurvey$PC01_12,"3") = "mittelmäßig"
attr(dat_SosciSurvey$PC01_12,"4") = "überwiegend"
attr(dat_SosciSurvey$PC01_12,"5") = "völlig"
attr(dat_SosciSurvey$PC01_06,"1") = "gar nicht"
attr(dat_SosciSurvey$PC01_06,"2") = "wenig"
attr(dat_SosciSurvey$PC01_06,"3") = "mittelmäßig"
attr(dat_SosciSurvey$PC01_06,"4") = "überwiegend"
attr(dat_SosciSurvey$PC01_06,"5") = "völlig"
attr(dat_SosciSurvey$PC01_11,"1") = "gar nicht"
attr(dat_SosciSurvey$PC01_11,"2") = "wenig"
attr(dat_SosciSurvey$PC01_11,"3") = "mittelmäßig"
attr(dat_SosciSurvey$PC01_11,"4") = "überwiegend"
attr(dat_SosciSurvey$PC01_11,"5") = "völlig"
attr(dat_SosciSurvey$PC01_04,"1") = "gar nicht"
attr(dat_SosciSurvey$PC01_04,"2") = "wenig"
attr(dat_SosciSurvey$PC01_04,"3") = "mittelmäßig"
attr(dat_SosciSurvey$PC01_04,"4") = "überwiegend"
attr(dat_SosciSurvey$PC01_04,"5") = "völlig"
attr(dat_SosciSurvey$PC01_03,"1") = "gar nicht"
attr(dat_SosciSurvey$PC01_03,"2") = "wenig"
attr(dat_SosciSurvey$PC01_03,"3") = "mittelmäßig"
attr(dat_SosciSurvey$PC01_03,"4") = "überwiegend"
attr(dat_SosciSurvey$PC01_03,"5") = "völlig"
attr(dat_SosciSurvey$PC06_01,"1") = "völlig unrepräsentativ"
attr(dat_SosciSurvey$PC06_01,"2") = "etwas unrepräsentativ"
attr(dat_SosciSurvey$PC06_01,"3") = "ein wenig unrepräsentativ"
attr(dat_SosciSurvey$PC06_01,"4") = "weder unrepräsentativ noch repräsentativ"
attr(dat_SosciSurvey$PC06_01,"5") = "ein wenig repräsentativ"
attr(dat_SosciSurvey$PC06_01,"6") = "etwas repräsentativ"
attr(dat_SosciSurvey$PC06_01,"7") = "völlig repräsentativ"
attr(dat_SosciSurvey$PC06_02,"1") = "völlig unrepräsentativ"
attr(dat_SosciSurvey$PC06_02,"2") = "etwas unrepräsentativ"
attr(dat_SosciSurvey$PC06_02,"3") = "ein wenig unrepräsentativ"
attr(dat_SosciSurvey$PC06_02,"4") = "weder unrepräsentativ noch repräsentativ"
attr(dat_SosciSurvey$PC06_02,"5") = "ein wenig repräsentativ"
attr(dat_SosciSurvey$PC06_02,"6") = "etwas repräsentativ"
attr(dat_SosciSurvey$PC06_02,"7") = "völlig repräsentativ"
attr(dat_SosciSurvey$PC02_01,"1") = "1 nie/keine"
attr(dat_SosciSurvey$PC02_01,"2") = "2 sehr selten/wenige"
attr(dat_SosciSurvey$PC02_01,"3") = "3 selten/wenige"
attr(dat_SosciSurvey$PC02_01,"4") = "4 manchmal/etwas"
attr(dat_SosciSurvey$PC02_01,"5") = "5 oft/viele"
attr(dat_SosciSurvey$PC02_01,"6") = "6 sehr oft/sehr viele"
attr(dat_SosciSurvey$PC02_02,"1") = "1 nie/keine"
attr(dat_SosciSurvey$PC02_02,"2") = "2 sehr selten/wenige"
attr(dat_SosciSurvey$PC02_02,"3") = "3 selten/wenige"
attr(dat_SosciSurvey$PC02_02,"4") = "4 manchmal/etwas"
attr(dat_SosciSurvey$PC02_02,"5") = "5 oft/viele"
attr(dat_SosciSurvey$PC02_02,"6") = "6 sehr oft/sehr viele"
attr(dat_SosciSurvey$PC02_03,"1") = "1 nie/keine"
attr(dat_SosciSurvey$PC02_03,"2") = "2 sehr selten/wenige"
attr(dat_SosciSurvey$PC02_03,"3") = "3 selten/wenige"
attr(dat_SosciSurvey$PC02_03,"4") = "4 manchmal/etwas"
attr(dat_SosciSurvey$PC02_03,"5") = "5 oft/viele"
attr(dat_SosciSurvey$PC02_03,"6") = "6 sehr oft/sehr viele"
attr(dat_SosciSurvey$PC02_08,"1") = "1 nie/keine"
attr(dat_SosciSurvey$PC02_08,"2") = "2 sehr selten/wenige"
attr(dat_SosciSurvey$PC02_08,"3") = "3 selten/wenige"
attr(dat_SosciSurvey$PC02_08,"4") = "4 manchmal/etwas"
attr(dat_SosciSurvey$PC02_08,"5") = "5 oft/viele"
attr(dat_SosciSurvey$PC02_08,"6") = "6 sehr oft/sehr viele"
attr(dat_SosciSurvey$PC02_04,"1") = "1 nie/keine"
attr(dat_SosciSurvey$PC02_04,"2") = "2 sehr selten/wenige"
attr(dat_SosciSurvey$PC02_04,"3") = "3 selten/wenige"
attr(dat_SosciSurvey$PC02_04,"4") = "4 manchmal/etwas"
attr(dat_SosciSurvey$PC02_04,"5") = "5 oft/viele"
attr(dat_SosciSurvey$PC02_04,"6") = "6 sehr oft/sehr viele"
attr(dat_SosciSurvey$PC02_05,"1") = "1 nie/keine"
attr(dat_SosciSurvey$PC02_05,"2") = "2 sehr selten/wenige"
attr(dat_SosciSurvey$PC02_05,"3") = "3 selten/wenige"
attr(dat_SosciSurvey$PC02_05,"4") = "4 manchmal/etwas"
attr(dat_SosciSurvey$PC02_05,"5") = "5 oft/viele"
attr(dat_SosciSurvey$PC02_05,"6") = "6 sehr oft/sehr viele"
attr(dat_SosciSurvey$PC02_06,"1") = "1 nie/keine"
attr(dat_SosciSurvey$PC02_06,"2") = "2 sehr selten/wenige"
attr(dat_SosciSurvey$PC02_06,"3") = "3 selten/wenige"
attr(dat_SosciSurvey$PC02_06,"4") = "4 manchmal/etwas"
attr(dat_SosciSurvey$PC02_06,"5") = "5 oft/viele"
attr(dat_SosciSurvey$PC02_06,"6") = "6 sehr oft/sehr viele"
attr(dat_SosciSurvey$PC02_07,"1") = "1 nie/keine"
attr(dat_SosciSurvey$PC02_07,"2") = "2 sehr selten/wenige"
attr(dat_SosciSurvey$PC02_07,"3") = "3 selten/wenige"
attr(dat_SosciSurvey$PC02_07,"4") = "4 manchmal/etwas"
attr(dat_SosciSurvey$PC02_07,"5") = "5 oft/viele"
attr(dat_SosciSurvey$PC02_07,"6") = "6 sehr oft/sehr viele"
attr(dat_SosciSurvey$PC03_01,"1") = "trifft gar nicht zu"
attr(dat_SosciSurvey$PC03_01,"2") = "trifft wenig zu"
attr(dat_SosciSurvey$PC03_01,"3") = "trifft teils-teils zu"
attr(dat_SosciSurvey$PC03_01,"4") = "trifft ziemlich zu"
attr(dat_SosciSurvey$PC03_01,"5") = "trifft völlig zu"
attr(dat_SosciSurvey$PC03_02,"1") = "trifft gar nicht zu"
attr(dat_SosciSurvey$PC03_02,"2") = "trifft wenig zu"
attr(dat_SosciSurvey$PC03_02,"3") = "trifft teils-teils zu"
attr(dat_SosciSurvey$PC03_02,"4") = "trifft ziemlich zu"
attr(dat_SosciSurvey$PC03_02,"5") = "trifft völlig zu"
attr(dat_SosciSurvey$PC03_04,"1") = "trifft gar nicht zu"
attr(dat_SosciSurvey$PC03_04,"2") = "trifft wenig zu"
attr(dat_SosciSurvey$PC03_04,"3") = "trifft teils-teils zu"
attr(dat_SosciSurvey$PC03_04,"4") = "trifft ziemlich zu"
attr(dat_SosciSurvey$PC03_04,"5") = "trifft völlig zu"
attr(dat_SosciSurvey$PC03_06,"1") = "trifft gar nicht zu"
attr(dat_SosciSurvey$PC03_06,"2") = "trifft wenig zu"
attr(dat_SosciSurvey$PC03_06,"3") = "trifft teils-teils zu"
attr(dat_SosciSurvey$PC03_06,"4") = "trifft ziemlich zu"
attr(dat_SosciSurvey$PC03_06,"5") = "trifft völlig zu"
attr(dat_SosciSurvey$PC03_07,"1") = "trifft gar nicht zu"
attr(dat_SosciSurvey$PC03_07,"2") = "trifft wenig zu"
attr(dat_SosciSurvey$PC03_07,"3") = "trifft teils-teils zu"
attr(dat_SosciSurvey$PC03_07,"4") = "trifft ziemlich zu"
attr(dat_SosciSurvey$PC03_07,"5") = "trifft völlig zu"
attr(dat_SosciSurvey$PC03_08,"1") = "trifft gar nicht zu"
attr(dat_SosciSurvey$PC03_08,"2") = "trifft wenig zu"
attr(dat_SosciSurvey$PC03_08,"3") = "trifft teils-teils zu"
attr(dat_SosciSurvey$PC03_08,"4") = "trifft ziemlich zu"
attr(dat_SosciSurvey$PC03_08,"5") = "trifft völlig zu"
attr(dat_SosciSurvey$PC03_09,"1") = "trifft gar nicht zu"
attr(dat_SosciSurvey$PC03_09,"2") = "trifft wenig zu"
attr(dat_SosciSurvey$PC03_09,"3") = "trifft teils-teils zu"
attr(dat_SosciSurvey$PC03_09,"4") = "trifft ziemlich zu"
attr(dat_SosciSurvey$PC03_09,"5") = "trifft völlig zu"
attr(dat_SosciSurvey$PC03_10,"1") = "trifft gar nicht zu"
attr(dat_SosciSurvey$PC03_10,"2") = "trifft wenig zu"
attr(dat_SosciSurvey$PC03_10,"3") = "trifft teils-teils zu"
attr(dat_SosciSurvey$PC03_10,"4") = "trifft ziemlich zu"
attr(dat_SosciSurvey$PC03_10,"5") = "trifft völlig zu"
attr(dat_SosciSurvey$PC03_11,"1") = "trifft gar nicht zu"
attr(dat_SosciSurvey$PC03_11,"2") = "trifft wenig zu"
attr(dat_SosciSurvey$PC03_11,"3") = "trifft teils-teils zu"
attr(dat_SosciSurvey$PC03_11,"4") = "trifft ziemlich zu"
attr(dat_SosciSurvey$PC03_11,"5") = "trifft völlig zu"
attr(dat_SosciSurvey$FINISHED,"F") = "abgebrochen"
attr(dat_SosciSurvey$FINISHED,"T") = "ausgefüllt"
attr(dat_SosciSurvey$Q_VIEWER,"F") = "Teilnehmer"
attr(dat_SosciSurvey$Q_VIEWER,"T") = "Durchklicker"
comment(dat_SosciSurvey$SERIAL) = "Personenkennung oder Teilnahmecode (sofern verwendet)"
comment(dat_SosciSurvey$REF) = "Referenz (sofern im Link angegeben)"
comment(dat_SosciSurvey$QUESTNNR) = "Fragebogen, der im Interview verwendet wurde"
comment(dat_SosciSurvey$MODE) = "Interview-Modus"
comment(dat_SosciSurvey$STARTED) = "Zeitpunkt zu dem das Interview begonnen hat (Europe/Berlin)"
comment(dat_SosciSurvey$AB01) = "Höchster Bildungsabschluss"
comment(dat_SosciSurvey$BD01_01) = "Alter:  ... Jahre"
comment(dat_SosciSurvey$BD02) = "Geschlecht"
comment(dat_SosciSurvey$BD04) = "Muttersprache"
comment(dat_SosciSurvey$BD04_02) = "Muttersprache: Nein, sondern"
comment(dat_SosciSurvey$BD06) = "BD06"
comment(dat_SosciSurvey$BD07) = "LeaderGroup"
comment(dat_SosciSurvey$GE01_01) = "Wissen Econ Env: Wirtschaftsthemen"
comment(dat_SosciSurvey$GE01_02) = "Wissen Econ Env: Ökologische Nachhaltigkeit"
comment(dat_SosciSurvey$GE02) = "Positionierungsfrage"
comment(dat_SosciSurvey$GP_01) = "16C_erste 10: Anhaltendes Wirtschaftswachstum ist unerlässlich, um die Lebenszufriedenheit der Menschen zu verbessern. (umgepolt)"
comment(dat_SosciSurvey$GP_02) = "16C_erste 10: Wirtschaftswachstum ist notwendig, um öffentliche Gesundheits- und Rentensysteme zu finanzieren. (umgepolt)"
comment(dat_SosciSurvey$GP_03) = "16C_erste 10: Ohne Wirtschaftswachstum wird die Wirtschaft instabiler werden. (umgepolt)"
comment(dat_SosciSurvey$GP_04) = "16C_erste 10: Wirtschaftswachstum ist notwendig, um Umweltschutz zu finanzieren. (umgepolt)"
comment(dat_SosciSurvey$GP_05) = "16C_erste 10: Vollbeschäftigung kann ohne Wirtschaftswachstum erreicht werden."
comment(dat_SosciSurvey$GP_06) = "16C_erste 10: Ein ‘gutes Leben’ ohne Wirtschaftswachstum ist möglich."
comment(dat_SosciSurvey$GP_07) = "16C_erste 10: Energieeinsparungen durch technische Fortschritte werden teilweise durch weiteres Wirtschaftswachstum zunichte gemacht."
comment(dat_SosciSurvey$GP_08) = "16C_erste 10: Wirtschaftswachstum schadet immer der Umwelt."
comment(dat_SosciSurvey$GP_09) = "16C_erste 10: Angesichts begrenzter natürlicher Ressourcen müssen reiche Länder möglicherweise ihr Wirtschaftswachstum aufgeben, um sicherzustellen, dass alle armen Menschen auf der Welt einen angemessenen Lebensstandard erreichen können."
comment(dat_SosciSurvey$GP_10) = "16C_erste 10: Technologie kann alle Umweltprobleme lösen, die mit Wirtschaftswachstum zusammenhängen. (umgepolt)"
comment(dat_SosciSurvey$GP_11) = "16_C_restl 6: Zukünftiges Wirtschaftswachstum wird sich wieder erholen und so hoch wie in der Vergangenheit sein. (umgepolt)"
comment(dat_SosciSurvey$GP_12) = "16_C_restl 6: Wirtschaftswachstum erhöht Einkommen, was dazu führt, dass Menschen sich mehr um die Umwelt kümmern. (umgepolt)"
comment(dat_SosciSurvey$GP_13) = "16_C_restl 6: Die Politikerinnen und Politiker sind zu besorgt über das Wirtschaftswachstum."
comment(dat_SosciSurvey$GP_14) = "16_C_restl 6: Die Einkommensverteilung anzugleichen, sollte eine höhere Priorität haben als Wirtschaftswachstum."
comment(dat_SosciSurvey$GP_15) = "16_C_restl 6: Das BIP ist für gesellschaftlichen Wohlstand ein fehlerhaftes Maß."
comment(dat_SosciSurvey$GP_16) = "16_C_restl 6: Wirtschaftswachstum kann durch die Regierung gesteuert werden."
comment(dat_SosciSurvey$IC01) = "Informed Consent (deutsch)"
comment(dat_SosciSurvey$PC01_05) = "Übereinstimmung: Wie sehr stimmen die positiven (grünen) Konzepte der Mind-Map der Gruppenarbeit mit Ihrer eigenen Mind-Map überein?"
comment(dat_SosciSurvey$PC01_08) = "Übereinstimmung: Wie sehr stimmen die negativen (roten) Konzepte der Mind-Map der Gruppenarbeit mit Ihrer eigenen Mind-Map überein?"
comment(dat_SosciSurvey$PC01_09) = "Übereinstimmung: Wie sehr stimmen die neutralen (gelben) Konzepte der Mind-Map der Gruppenarbeit mit Ihrer eigenen Mind-Map überein?"
comment(dat_SosciSurvey$PC01_12) = "Übereinstimmung: Wie sehr stimmen die die ambivalenten (lilalen) Konzepte der Mind-Map der Gruppenarbeit mit Ihrer eigenen Mind-Map überein?"
comment(dat_SosciSurvey$PC01_06) = "Übereinstimmung: Wie sehr stimmt die Mind-Map der Gruppenarbeit in Ihren hemmenden Verbindungen zwischen den einzelnen Konzepten mit Ihrer eigenen Mind-Map überein?"
comment(dat_SosciSurvey$PC01_11) = "Übereinstimmung: Wie sehr stimmt die Mind-Map der Gruppenarbeit in Ihren verstärkenden Verbindungen zwischen den einzelnen Konzepten mit Ihrer eigenen Mind-Map überein?"
comment(dat_SosciSurvey$PC01_04) = "Übereinstimmung: Wie sehr beinhaltet die Mind-Map der Gruppenarbeit die Konzepte Ihrer eigenen Mind-Map?"
comment(dat_SosciSurvey$PC01_03) = "Übereinstimmung: Wie sehr stimmt die Mind-Map der Gruppenarbeit insgesamt mit Ihrer eigenen Mind-Map überein?"
comment(dat_SosciSurvey$PC06_01) = "Repräsentativität: Inwieweit spiegelt Ihre indivduelle Mind-Map Ihre Einstellungen und Gefühle zu Wirtschaftswachstum und ökologischer Nachhaltigkeit wieder?"
comment(dat_SosciSurvey$PC06_02) = "Repräsentativität: Inwieweit spiegelt die Mind-Map aus der Gruppenarbeit Ihre Einstellungen und Gefühle zu Wirtschaftswachstum und ökologischer Nachhaltigkeit wieder?"
comment(dat_SosciSurvey$PC02_01) = "ICS Deutsch Lehmann: Wie viele Reibereien gab es zwischen den Gruppenmitgliedern?"
comment(dat_SosciSurvey$PC02_02) = "ICS Deutsch Lehmann: Wie offensichtlich waren persönliche Konflikte in der Gruppe?"
comment(dat_SosciSurvey$PC02_03) = "ICS Deutsch Lehmann: Wie viele Spannungen gab es zwischen den Gruppenmitgliedern?"
comment(dat_SosciSurvey$PC02_08) = "ICS Deutsch Lehmann: Wie viele emotionale Konflikte gab es zwischen den Gruppenmitgliedern?"
comment(dat_SosciSurvey$PC02_04) = "ICS Deutsch Lehmann: Wie oft waren sich die Gruppenmitglieder uneinig, wie die Arbeit zu erledigen ist?"
comment(dat_SosciSurvey$PC02_05) = "ICS Deutsch Lehmann: Wie häufig gab es Ideenkonflikte in der Gruppe?"
comment(dat_SosciSurvey$PC02_06) = "ICS Deutsch Lehmann: Wie viele die Arbeit betreffende Konflikte gab es in der Gruppe?"
comment(dat_SosciSurvey$PC02_07) = "ICS Deutsch Lehmann: In welchem Ausmaß gab es Meinungsverschiedenheiten in der Gruppe?"
comment(dat_SosciSurvey$PC03_01) = "Eigene Items: Ich bin mit dem Ergebnis der Gruppenarbeit zufrieden."
comment(dat_SosciSurvey$PC03_02) = "Eigene Items: Ich würde das Ergebnis der Gruppenarbeit gerne verändern."
comment(dat_SosciSurvey$PC03_04) = "Eigene Items: Ich habe durch die Gruppenarbeit neues gelernt."
comment(dat_SosciSurvey$PC03_06) = "Eigene Items: Die Gruppenarbeit empfand ich als positiv."
comment(dat_SosciSurvey$PC03_07) = "Eigene Items: Die Gruppenarbeit empfand ich als negativ."
comment(dat_SosciSurvey$PC03_08) = "Eigene Items: Meine Einstellung zu Wirtschaftswachstum und ökologischer Nachhaltigkeit hat sich durch die Gruppenarbeit verändert."
comment(dat_SosciSurvey$PC03_09) = "Eigene Items: Die Gruppenarbeit hat mich in meiner Einstellung zu Wirtschaftswachstum und ölologischer Nachhaltigkeit bestärkt."
comment(dat_SosciSurvey$PC03_10) = "Eigene Items: Die Teilnehmenden haben sich bei der Gruppenarbeit gleichermaßen eingebracht."
comment(dat_SosciSurvey$PC03_11) = "Eigene Items: Ich kannte mindestens eine/n der Teilnehmenden meiner Gruppe zuvor."
comment(dat_SosciSurvey$PC0_GN) = "Gruppennummer: [01]"
comment(dat_SosciSurvey$PO01) = "Sonntagsfrage"
comment(dat_SosciSurvey$PO01_07) = "Sonntagsfrage: Andere"
comment(dat_SosciSurvey$SO01_01) = "Anmerkungen?: [01]"
comment(dat_SosciSurvey$TE01_RV1) = "POST/GET-Variable: participantID"
comment(dat_SosciSurvey$TE02) = "Technische Probleme?"
comment(dat_SosciSurvey$TE02_02) = "Technische Probleme?: Ja, und zwar"
comment(dat_SosciSurvey$TIME001) = "Verweildauer Seite 1"
comment(dat_SosciSurvey$TIME002) = "Verweildauer Seite 2"
comment(dat_SosciSurvey$TIME003) = "Verweildauer Seite 3"
comment(dat_SosciSurvey$TIME004) = "Verweildauer Seite 4"
comment(dat_SosciSurvey$TIME005) = "Verweildauer Seite 5"
comment(dat_SosciSurvey$TIME006) = "Verweildauer Seite 6"
comment(dat_SosciSurvey$TIME007) = "Verweildauer Seite 7"
comment(dat_SosciSurvey$TIME008) = "Verweildauer Seite 8"
comment(dat_SosciSurvey$TIME009) = "Verweildauer Seite 9"
comment(dat_SosciSurvey$TIME010) = "Verweildauer Seite 10"
comment(dat_SosciSurvey$TIME011) = "Verweildauer Seite 11"
comment(dat_SosciSurvey$TIME012) = "Verweildauer Seite 12"
comment(dat_SosciSurvey$TIME013) = "Verweildauer Seite 13"
comment(dat_SosciSurvey$TIME014) = "Verweildauer Seite 14"
comment(dat_SosciSurvey$TIME015) = "Verweildauer Seite 15"
comment(dat_SosciSurvey$TIME016) = "Verweildauer Seite 16"
comment(dat_SosciSurvey$TIME017) = "Verweildauer Seite 17"
comment(dat_SosciSurvey$TIME018) = "Verweildauer Seite 18"
comment(dat_SosciSurvey$TIME019) = "Verweildauer Seite 19"
comment(dat_SosciSurvey$TIME020) = "Verweildauer Seite 20"
comment(dat_SosciSurvey$TIME021) = "Verweildauer Seite 21"
comment(dat_SosciSurvey$TIME022) = "Verweildauer Seite 22"
comment(dat_SosciSurvey$TIME023) = "Verweildauer Seite 23"
comment(dat_SosciSurvey$TIME024) = "Verweildauer Seite 24"
comment(dat_SosciSurvey$TIME025) = "Verweildauer Seite 25"
comment(dat_SosciSurvey$TIME026) = "Verweildauer Seite 26"
comment(dat_SosciSurvey$TIME027) = "Verweildauer Seite 27"
comment(dat_SosciSurvey$TIME028) = "Verweildauer Seite 28"
comment(dat_SosciSurvey$TIME029) = "Verweildauer Seite 29"
comment(dat_SosciSurvey$TIME_SUM) = "Verweildauer gesamt (ohne Ausreißer)"
comment(dat_SosciSurvey$MAILSENT) = "Versandzeitpunkt der Einladungsmail (nur für nicht-anonyme Adressaten)"
comment(dat_SosciSurvey$LASTDATA) = "Zeitpunkt als der Datensatz das letzte mal geändert wurde"
comment(dat_SosciSurvey$FINISHED) = "Wurde die Befragung abgeschlossen (letzte Seite erreicht)?"
comment(dat_SosciSurvey$Q_VIEWER) = "Hat der Teilnehmer den Fragebogen nur angesehen, ohne die Pflichtfragen zu beantworten?"
comment(dat_SosciSurvey$LASTPAGE) = "Seite, die der Teilnehmer zuletzt bearbeitet hat"
comment(dat_SosciSurvey$MAXPAGE) = "Letzte Seite, die im Fragebogen bearbeitet wurde"
comment(dat_SosciSurvey$MISSING) = "Anteil fehlender Antworten in Prozent"
comment(dat_SosciSurvey$MISSREL) = "Anteil fehlender Antworten (gewichtet nach Relevanz)"
comment(dat_SosciSurvey$TIME_RSI) = "Ausfüll-Geschwindigkeit (relativ)"
DT::datatable(dat_SosciSurvey, options = list(pageLength = 5)) 

clean data

# table(dat_SosciSurvey$QUESTNNR)
backup <- dat_SosciSurvey
# dat_SosciSurvey <- backup

## keep only persons who finished the respective study parts
dat_SosciSurvey <- dat_SosciSurvey[dat_SosciSurvey$FINISHED, ]
table(dat_SosciSurvey$QUESTNNR)

Group_CAM_Pre  Ind_CAM_Post   Ind_CAM_Pre 
           11            34            34 
## remove all variables containing only NA values
dat_SosciSurvey <- dat_SosciSurvey[, colSums(x = is.na(dat_SosciSurvey)) != nrow(dat_SosciSurvey)]
## remove all time variables
dat_SosciSurvey <- dat_SosciSurvey[, str_detect(string = colnames(dat_SosciSurvey), pattern = "TIME[:digit:]", negate = TRUE)]
## remove finished (not needed)
dat_SosciSurvey$FINISHED <- NULL


dat_SosciSurvey_preCAMs  <- dat_SosciSurvey[dat_SosciSurvey$QUESTNNR == "Ind_CAM_Pre", ]; ncol(x = dat_SosciSurvey_preCAMs)
[1] 73
## remove all variables containing only NA values
dat_SosciSurvey_preCAMs <- dat_SosciSurvey_preCAMs[, colSums(x = is.na(dat_SosciSurvey_preCAMs)) != nrow(dat_SosciSurvey_preCAMs)]; ncol(x = dat_SosciSurvey_preCAMs)
[1] 33
dat_SosciSurvey_postCAMs  <- dat_SosciSurvey[dat_SosciSurvey$QUESTNNR == "Ind_CAM_Post", ]; ncol(x = dat_SosciSurvey_postCAMs)
[1] 73
## remove all variables containing only NA values
dat_SosciSurvey_postCAMs <- dat_SosciSurvey_postCAMs[, colSums(x = is.na(dat_SosciSurvey_postCAMs)) != nrow(dat_SosciSurvey_postCAMs)]; ncol(x = dat_SosciSurvey_postCAMs)
[1] 70
vec_sum <- c()
list_ids <- list()

for(i in 1:sum(dat_SosciSurvey$QUESTNNR == "Group_CAM_Pre")){
  tmp_timeDifferences <- dat_SosciSurvey$STARTED[dat_SosciSurvey$QUESTNNR == "Ind_CAM_Pre"] - dat_SosciSurvey$STARTED[dat_SosciSurvey$QUESTNNR == "Group_CAM_Pre"][i]
  
  ## check
  vec_sum[i] <- sum(abs(tmp_timeDifferences) <= 2500)
  
  ## subset of data sets
  tmp_preCAMs <- dat_SosciSurvey_preCAMs[abs(tmp_timeDifferences) <= 2500,]
  tmp_postCAMs <- dat_SosciSurvey_postCAMs[dat_SosciSurvey_postCAMs$TE01_RV1 %in% tmp_preCAMs$CASE, ]
  
  list_ids[[i]] <- list(tmp_preCAMs$CASE,
                        dat_SosciSurvey$CASE[dat_SosciSurvey$QUESTNNR == "Group_CAM_Pre"][i])
  names(list_ids[[i]]) <- c("id_individual", "id_group")
  

  
  # order subsets
  tmp_preCAMs <- tmp_preCAMs[order(tmp_preCAMs$CASE), ]
  tmp_postCAMs <- tmp_postCAMs[order(tmp_postCAMs$TE01_RV1), ]
  
  ## check for IDs
  if(!all(tmp_preCAMs$CASE == tmp_postCAMs$TE01_RV1)){
    print("ERROR")
    break
  }
  
  colnames(tmp_preCAMs) <- paste0(colnames(tmp_preCAMs), "_pre")
  colnames(tmp_postCAMs) <- paste0(colnames(tmp_postCAMs), "_post")

  if(i == 1){
    dat_SosciSurvey_final <- cbind(tmp_preCAMs, tmp_postCAMs)
  }else{
    dat_SosciSurvey_final <- rbind(dat_SosciSurvey_final, cbind(tmp_preCAMs, tmp_postCAMs))
  }
}


if(sum(vec_sum) == length(CAMdrawn_individual)){
  print("the threshold was correctly choosen")
}else{
  print("ERROR - check threshold")
}
[1] "the threshold was correctly choosen"
rm(dat_SosciSurvey_preCAMs)
rm(dat_SosciSurvey_postCAMs)
rm(tmp_preCAMs)
rm(tmp_postCAMs)
rm(vec_sum)



### add network indicators
dat_SosciSurvey_CAM_final <- dat_SosciSurvey_final

dat_SosciSurvey_CAM_final[, paste0(colnames(networkIndicators_individual), "_ind")] <- NA
dat_SosciSurvey_CAM_final[, paste0(colnames(networkIndicators_group), "_group")] <- NA


for(i in 1:length(list_ids)){
  tmp_NetworkIndicators_ind <- networkIndicators_individual[networkIndicators_individual$participantCAM %in% list_ids[[i]]$id_individual,]
    tmp_NetworkIndicators_group <- networkIndicators_group[networkIndicators_group$participantCAM %in% list_ids[[i]]$id_group,]
  
  tmp_dat <- dat_SosciSurvey_CAM_final[dat_SosciSurvey_CAM_final$CASE_pre %in% list_ids[[i]]$id_individual,]
    
    ## order according to IDs
   tmp_NetworkIndicators_ind <- tmp_NetworkIndicators_ind[order(match(tmp_NetworkIndicators_ind$participantCAM, tmp_dat$CASE_pre)), ]
  

   if(!all(tmp_dat$CASE_pre == tmp_NetworkIndicators_ind$participantCAM)){
     print(i)
   }else{
     ## add individual
     dat_SosciSurvey_CAM_final[dat_SosciSurvey_CAM_final$CASE_pre %in% list_ids[[i]]$id_individual, paste0(colnames(networkIndicators_individual), "_ind")] <- tmp_NetworkIndicators_ind
     
     ## add group
     dat_SosciSurvey_CAM_final[dat_SosciSurvey_CAM_final$CASE_pre %in% list_ids[[i]]$id_individual, paste0(colnames(networkIndicators_individual), "_group")] <- tmp_NetworkIndicators_group
   }
}

rm(tmp_NetworkIndicators_ind)
rm(tmp_NetworkIndicators_group)

create combined CAM graphics

if(save_CAMs_as_pictures_combined){
  setwd("outputs")
  setwd("savedCAMs_combined")
}
### create graphics for CAMs
for(i in 1:length(list_ids)){
  if(length(list_ids[[i]]$id_individual) == 3){
    par(mfrow = c(2, 2)) # Create a 2 x 2 plotting matrix
  }else{
    par(mfrow = c(2, 3)) # Create a 2 x 2 plotting matrix
  }
  
  for(j in list_ids[[i]]$id_individual){
    
    plot(CAMdrawn_individual[[as.character(j)]], edge.arrow.size = .2,
       layout=layout_nicely, vertex.frame.color="black", asp = .5, margin = 0,
       vertex.size = 10, vertex.label.cex = .7, main = paste0("individual CAM ", as.character(j)))
    }
  
      plot(CAMdrawn_group[[as.character(list_ids[[i]]$id_group)]], edge.arrow.size = .2,
       layout=layout_nicely, vertex.frame.color="black", asp = .5, margin = 0,
       vertex.size = 10, vertex.label.cex = .7, main = paste0("group CAM ", as.character(list_ids[[i]]$id_group)))
      
      
      if(save_CAMs_as_pictures_combined){
        # dir.create(path = as.character(list_ids[[i]]$id_group))
        
          save_graphic(filename = paste0("group_", as.character(list_ids[[i]]$id_group))) 
 dev.off()
      }
}

create combined wordlists

setwd("outputs")
setwd("savedWordlists_combined")


### create graphics for CAMs
for(i in 1:length(list_ids)){
  
  tmp_concepts_ind <- CAMfiles_individual[[1]][CAMfiles_individual[[1]]$participantCAM %in% list_ids[[i]]$id_individual, ]
  tmp_concepts_group <- CAMfiles_group[[1]][CAMfiles_group[[1]]$participantCAM %in% list_ids[[i]]$id_group, ]

  ## add variables individual
  tmp_concepts_ind$type <- "individual"
  tmp_concepts_ind$Rating_Lars <- NA
  tmp_concepts_ind$Comment_Lars <- NA

  ## add variables group  
  tmp_concepts_group$type <- "group"
  tmp_concepts_group$Rating_Lars <- NA
  tmp_concepts_group$Comment_Lars <- NA

  
  
 tmp_out <-  rbind(tmp_concepts_ind[, c("type", "participantCAM", "id", "text", "value", "comment", "Rating_Lars", "Comment_Lars")],
    tmp_concepts_group[, c("type", "participantCAM", "id", "text", "value", "comment", "Rating_Lars", "Comment_Lars")])
    
  write.xlsx2(x = tmp_out, file = paste0(paste0(unique(tmp_out$participantCAM), collapse = " "), ".xlsx"))
}

save wordlists

setwd("outputs")

## save CAM word lists
# for individual
xlsx::write.xlsx2(x = CAMwordlist_individual, file = "CAMwordlist_individual.xlsx")
# for group
xlsx::write.xlsx2(x = CAMwordlist_group, file = "CAMwordlist_group.xlsx")

set up merged CAM data

setwd("outputs/data CAMs")

### load CAM files
suppressMessages(read_file("CAMdata_IndGroup.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_indGroup


raw_CAM_indGroup <- list()
for(i in 1:length(dat_CAM_indGroup)){
  raw_CAM_indGroup[[i]] <- jsonlite::fromJSON(txt = dat_CAM_indGroup[[i]])
}
rm(dat_CAM_indGroup)

Create CAM files, draw CAMs and compute network indicators

### create CAM single files (nodes, connectors, merged)
CAMfiles_indGroup <- create_CAMfiles(datCAM = raw_CAM_indGroup, reDeleted = TRUE)
Nodes and connectors, which were deleted by participants were removed. 
 # deleted nodes:  103 
 # deleted connectors:  32
## remove empty concepts:
CAMfiles_indGroup[[1]]$text[nchar(CAMfiles_indGroup[[1]]$text) < 2]
character(0)
# tmp_ids <- CAMfiles_indGroup[[1]]$id[nchar(CAMfiles_indGroup[[1]]$text) < 2]
# table(CAMfiles_indGroup[[1]]$isActive[CAMfiles_indGroup[[1]]$id %in% tmp_ids])
# CAMfiles_indGroup[[1]] <- CAMfiles_indGroup[[1]][!CAMfiles_indGroup[[1]]$id %in% tmp_ids,]

### apply protocol
setwd("outputs CAM-App/02_summarized_CAMdata_IndGroup_word2vec")
text <- readLines("protocol.txt", warn = FALSE)
text <- readLines(textConnection(text, encoding = "UTF-8"), encoding = "UTF-8")

if (testIfJson(file = text)) {
  protocol <-
    rjson::fromJSON(file = "protocol.txt")
  
  ## no CAM deleted
  print(protocol$deletedCAMs)

  tmp_out <- overwriteTextNodes(protocolDat = protocol,
                                nodesDat = CAMfiles_indGroup[[1]])
  CAMfiles_indGroup[[1]] <- tmp_out[[1]]
  # tmp_out[[2]]
  
} else{
  print("Invalid protocol uploaded")
}
list()

time 2024-04-23 11:11:07.803457 at index 1 for approximate matching 
time 2024-04-23 11:11:10.046564 at index 2 for approximate matching 
time 2024-04-23 11:11:16.792532 at index 3 for approximate matching 
time 2024-04-23 11:11:20.44261 at index 4 for approximate matching 
time 2024-04-23 11:11:22.770141 at index 5 for approximate matching 
time 2024-04-23 11:11:28.216995 at index 6 for approximate matching 
time 2024-04-23 11:11:30.96704 at index 7 for approximate matching 
time 2024-04-23 11:11:34.232146 at index 8 for approximate matching 
time 2024-04-23 11:11:38.518702 at index 9 for approximate matching 
time 2024-04-23 11:11:41.921861 at index 10 for approximate matching 
time 2024-04-23 11:11:45.699885 at index 11 for approximate matching 
time 2024-04-23 11:11:51.34494 at index 12 for approximate matching 
time 2024-04-23 11:12:13.3049 at index 13 for approximate matching 
time 2024-04-23 11:12:15.893749 at index 14 for approximate matching 
time 2024-04-23 11:12:20.275445 at index 15 for approximate matching 
time 2024-04-23 11:12:25.353507 at index 16 for approximate matching 
time 2024-04-23 11:12:41.383465 at index 17 for approximate matching 
time 2024-04-23 11:12:47.33484 at index 18 for approximate matching 
time 2024-04-23 11:13:18.634237 at index 19 for approximate matching 
time 2024-04-23 11:13:22.132808 at index 20 for approximate matching 
time 2024-04-23 11:13:45.906254 at index 21 for approximate matching 
time 2024-04-23 11:14:13.042581 at index 22 for approximate matching 
time 2024-04-23 11:14:39.832246 at index 23 for approximate matching 
time 2024-04-23 11:20:36.945985 at index 24 for search terms 
time 2024-04-23 11:21:17.93391 at index 25 for search terms 
time 2024-04-24 07:45:06.789174 at index 26 for word2vec 
### draw CAMs
CAMdrawn_indGroup <- draw_CAM(dat_merged = CAMfiles_indGroup[[3]],
                     dat_nodes = CAMfiles_indGroup[[1]],ids_CAMs = "all",
                     plot_CAM = FALSE,
                     useCoordinates = TRUE,
                     relvertexsize = 3,
                     reledgesize = 1)
processing 45 CAMs... 
[1] "== participantCAM in drawnCAM"
## check for non reasonable words
for(i in 1:length(CAMdrawn_indGroup)){
  if(any(nchar(V(CAMdrawn_indGroup[[i]])$label) < 3)){
    print(V(CAMdrawn_indGroup[[i]])$label)
  }
}

### network indicators
tmp_microIndicator <- c("Wirtschaftswachstum", "Ökologische Nachhaltigkeit") # pre-defined concepts
networkIndicators_indGroup <- compute_indicatorsCAM(drawn_CAM = CAMdrawn_indGroup, 
                                           micro_degree = tmp_microIndicator, 
                                           micro_valence = tmp_microIndicator, 
                                           micro_centr_clo = tmp_microIndicator, 
                                           micro_transitivity = tmp_microIndicator, 
                                           largestClique = FALSE)


## check for CAMs who have not changed valence
tmp_ids <- networkIndicators_individual$CAM_ID[is.na(networkIndicators_individual$assortativity_valence_macro)]
for(i in tmp_ids){
    plot(CAMdrawn_indGroup[[i]], edge.arrow.size = .7,
       layout=layout_nicely, vertex.frame.color="black", asp = .5, margin = -0.1,
       vertex.size = 10, vertex.label.cex = .9)
}


### wordlist
CAMwordlist_indGroup <- create_wordlist(
  dat_nodes =  CAMfiles_indGroup[[1]],
  dat_merged =  CAMfiles_indGroup[[3]],
  useSummarized = TRUE,
  order = "frequency",
  splitByValence = FALSE,
  comments = TRUE,
  raterSubsetWords = NULL,
  rater = FALSE
)
[1] "create_wordlist - use summarized words"
[1] 134
[1] 636
[1] "temporarily suffixes are added, because not all words have been summarized"
processing 45 CAMs... 
[1] "== participantCAM in drawnCAM"
DT::datatable(CAMwordlist_indGroup, options = list(pageLength = 5)) 

save final files

setwd("outputs")

## save Sosci Survey
xlsx::write.xlsx2(x = dat_SosciSurvey_final, file = "dat_SosciSurvey_final.xlsx")
write.csv2(x = dat_SosciSurvey_final, file = "dat_SosciSurvey_final.csv")
saveRDS(object = dat_SosciSurvey_final, file = "dat_SosciSurvey_final.rds")


## save Sosci Survey + CAM network indicators
xlsx::write.xlsx2(x = dat_SosciSurvey_CAM_final, file = "dat_SosciSurvey_CAM_final.xlsx")
write.csv2(x = dat_SosciSurvey_CAM_final, file = "dat_SosciSurvey_CAM_final.csv")
saveRDS(object = dat_SosciSurvey_CAM_final, file = "dat_SosciSurvey_CAM_final.rds")




## save CAM word lists
# for individual and group
xlsx::write.xlsx2(x = CAMwordlist_indGroup, file = "CAMwordlist_indGroup.xlsx")

analysis

Survey Data

summary(dat_SosciSurvey_final)

#Grupperungsvarialbe (Group Number Group CAM) in neuer Spalte Group in dat_SosciSurvey_final 
# // Neue Spalte 'Group' in dat_SosciSurvey_final anlegen mit Gruppen ID
dat_SosciSurvey_final$Group <- NA

# Durchlaufen Sie jede Zeile in dat_SosciSurvey_final
for (i in seq_len(nrow(dat_SosciSurvey_final))) {
  x <- dat_SosciSurvey_final$CASE_pre[i]
  
  # Durchlaufen Sie jedes Element in list_ids
  for (j in seq_along(list_ids)) {
    y <- list_ids[[j]][["id_individual"]]
    
    # Überprüfen Sie, ob x in y enthalten ist
    if (any(x == y)) {
      # Wenn ja, aktualisieren Sie den Wert in 'Group' mit dem entsprechenden 'id_group'
      dat_SosciSurvey_final$Group[i] <- list_ids[[j]][["id_group"]]
      break  # Beenden Sie die innere Schleife, da wir den passenden Wert gefunden haben
    }
  }
}

Sample Characteristics

#number participants
n_participants <- nrow(dat_SosciSurvey_final)
print(n_participants)
[1] 34
#age
tmp_age<- describe(dat_SosciSurvey_final$BD01_01_post, range = TRUE)
rownames(tmp_age) [1]<-"age"
tmp_age
    vars  n  mean   sd median trimmed  mad min max range skew kurtosis   se
age    1 34 22.18 2.83     21   21.75 1.48  19  31    12 1.36     1.37 0.49
# Plot frequency distribution age
ggplot(dat_SosciSurvey_final, aes(x = BD01_01_post)) +
  geom_histogram(binwidth = 1, fill = "skyblue", color = "black") +
  labs(x = "Age", y = "Frequency", title = "age distribution") +
  scale_y_continuous(breaks = seq(0, max(y), by = 1))  

#sex
anzahl_männlich <- sum(dat_SosciSurvey_final$BD02_post == "Männlich", na.rm = TRUE)
anzahl_weiblich <- sum(dat_SosciSurvey_final$BD02_post == "Weiblich", na.rm = TRUE)
anzahl_divers <- sum(dat_SosciSurvey_final$BD02_post == "Divers", na.rm = TRUE)
anzahl_keine_angabe <- sum(dat_SosciSurvey_final$BD02_post == "Das möchte ich nicht angeben", na.rm = TRUE)

sex_sosci <-data.frame(  Geschlecht = c("Männlich", "Weiblich", "Divers", "Das möchte ich nicht angeben"),
  Anzahl = c(anzahl_männlich, anzahl_weiblich, anzahl_divers, anzahl_keine_angabe))
#Prozent Geschlechter hinzufügen
gesamtanzahl <- sum(sex_sosci$Anzahl)
sex_sosci$Prozent <- round((sex_sosci$Anzahl / gesamtanzahl) * 100, digits=2)

#Ausgabe                          
print(sex_sosci)
                    Geschlecht Anzahl Prozent
1                     Männlich      7   20.59
2                     Weiblich     26   76.47
3                       Divers      0    0.00
4 Das möchte ich nicht angeben      1    2.94

Prior Knowledge on Econ Env

# GE01_01 = Economic issues /GE01_02 = Ecological Sustainability
#Deskritiv Summary
summary(dat_SosciSurvey_final[c("GE01_01_pre", "GE01_02_pre")])
  GE01_01_pre     GE01_02_pre   
 Min.   :1.000   Min.   :2.000  
 1st Qu.:2.000   1st Qu.:4.000  
 Median :2.000   Median :5.000  
 Mean   :2.765   Mean   :4.441  
 3rd Qu.:3.000   3rd Qu.:5.000  
 Max.   :6.000   Max.   :7.000  
#boxplot Econ Env prior knowledge
boxplot(dat_SosciSurvey_final$GE01_01_pre, dat_SosciSurvey_final$GE01_02_pre,
        names = c("Economic Issues", "Ecological Sustainability"),
        main = "Boxplot for prior knowledge",
        xlab = "variable", 
        ylab = "values",
        col = c("skyblue", "red"))

#t test 
report(t.test(dat_SosciSurvey_final$GE01_01_pre, dat_SosciSurvey_final$GE01_02_pre, paired = TRUE))
For paired samples, 'repeated_measures_d()' provides more options.
Effect sizes were labelled following Cohen's (1988) recommendations.

The Paired t-test testing the difference between
dat_SosciSurvey_final$GE01_01_pre and dat_SosciSurvey_final$GE01_02_pre (mean
difference = -1.68) suggests that the effect is negative, statistically
significant, and large (difference = -1.68, 95% CI [-2.20, -1.15], t(33) =
-6.47, p < .001; Cohen's d = -1.11, 95% CI [-1.53, -0.67])

Explicit position (pre/post)

#Grwoth-at-all-costs =1, Green Growth = 2, Agrowth = 3, Degrowth = 4
# "weiteres Wirtschaftswachstum verfolgen trotz der damit verbundenen Umweltfolgen." = 1 = Growth-at-all-costs
# "weiteres Wirtschaftswachstum verfolgen. Es gibt viele Wege, um Wirtschaftswachstum mit umweltbezogener Nachhaltigkeit kompatibel zu machen." =2 = Green Growth
# "Wirtschaftswachstum als politisches Ziel ignorieren, d.h. komplett neutral bezüglich Wachstum sein. Dies wird die Bandbreite politischer Maßnahmen erweitern, um Ziele des Wohlstands und der umweltbezogenen Nachhaltigkeit zu verbinden." = Agrowth
# "aufhören, Wirtschaftswachstum zu verfolgen. Produktion und Konsum müssen auf gerechte Weise reduziert werden, um umweltbezogene Nachhaltigkeit zu erreichen." = 4 = Degrowth

growthatall <- "weiteres Wirtschaftswachstum verfolgen trotz der damit verbundenen Umweltfolgen."
greengrowth <- "weiteres Wirtschaftswachstum verfolgen. Es gibt viele Wege, um Wirtschaftswachstum mit umweltbezogener Nachhaltigkeit kompatibel zu machen."
agrowth <- "Wirtschaftswachstum als politisches Ziel ignorieren, d.h. komplett neutral bezüglich Wachstum sein. Dies wird die Bandbreite politischer Maßnahmen erweitern, um Ziele des Wohlstands und der umweltbezogenen Nachhaltigkeit zu verbinden."
degrowth <- "aufhören, Wirtschaftswachstum zu verfolgen. Produktion und Konsum müssen auf gerechte Weise reduziert werden, um umweltbezogene Nachhaltigkeit zu erreichen."



# anzahl der Fälle bestimmen PRE
anzahl_growthatall <- sum(dat_SosciSurvey_final$GE02_pre == growthatall, na.rm = TRUE)
anzahl_greengrowth <- sum(dat_SosciSurvey_final$GE02_pre == greengrowth, na.rm = TRUE)
anzahl_agrowth <- sum(dat_SosciSurvey_final$GE02_pre == agrowth, na.rm = TRUE)
anzahl_degrowth <- sum(dat_SosciSurvey_final$GE02_pre == degrowth, na.rm = TRUE)

position_pre <-c(anzahl_growthatall, anzahl_greengrowth, anzahl_agrowth, anzahl_degrowth)

#datenframe erstellen und benennen
df_positonchoice<- data.frame(position_pre)
rownames(df_positonchoice) <-c("Growth at all cost", "Green Growth", "A-Growth", "Degrowth")
#histogramm pre 
# Plot frequency distribution position prior
ggplot(df_positonchoice, aes(x = rownames(df_positonchoice), y = position_pre)) +
  geom_bar(stat = "identity", fill = "skyblue", color = "black") +
  labs(x = "category", y = "frequency", title = "Preferred growth environment positon prior")

#anzahl der Fälle bestimmen POST
anzahl_growthatall_post <- sum(dat_SosciSurvey_final$GE02_post == growthatall, na.rm = TRUE)
anzahl_greengrowth_post <- sum(dat_SosciSurvey_final$GE02_post == greengrowth, na.rm = TRUE)
anzahl_agrowth_post <- sum(dat_SosciSurvey_final$GE02_post == agrowth, na.rm = TRUE)
anzahl_degrowth_post <- sum(dat_SosciSurvey_final$GE02_post == degrowth, na.rm = TRUE)

position_post <- c(anzahl_growthatall_post, anzahl_greengrowth_post, anzahl_agrowth_post, anzahl_degrowth_post)
df_positonchoice$positon_post <- position_post
#histogramm post
# Plot frequency distribution position post
ggplot(df_positonchoice, aes(x = rownames(df_positonchoice), y = position_post)) +
  geom_bar(stat = "identity", fill = "skyblue", color = "black") +
  labs(x = "category", y = "frequency", title = "Preferred growth environment positon post")

#positon choice pre post change
positionchoice <- data.frame(
  case = dat_SosciSurvey_final$CASE_pre,
  Pre = dat_SosciSurvey_final$GE02_pre,
  Post = dat_SosciSurvey_final$GE02_post
)

# Vergleich der 'Pre' und 'Post' Spalten und Ausgabe der 'case' Werte, die sich unterscheiden
unterschiedliche_cases <- positionchoice[positionchoice$Pre != positionchoice$Post, "case"]

# Ausgabe der 'case' Werte, die sich unterscheiden
print(unterschiedliche_cases)
[1] 654 698 725 727 734 736
# Ausgabe der Anzahl der Fälle, die sich unterscheiden
anzahl_unterschiedliche_cases <- length(unterschiedliche_cases)
print(anzahl_unterschiedliche_cases)
[1] 6

Implicit position (pre/post) (16 Items)

# Items bereits in SoSci invertiert
#invertieren items 1,2,3,4,10,11 and 12 
# library(car)


# dat_SosciSurvey_final$GP_01_pre <- recode(dat_SosciSurvey_final$GP_01_pre, "1=7;2=6;3=5;5=3;6=2;7=1")
# dat_SosciSurvey_final$GP_02_pre <- recode(dat_SosciSurvey_final$GP_02_pre, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# dat_SosciSurvey_final$GP_03_pre <- recode(dat_SosciSurvey_final$GP_03_pre, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# dat_SosciSurvey_final$GP_04_pre <- recode(dat_SosciSurvey_final$GP_04_pre, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# dat_SosciSurvey_final$GP_10_pre <- recode(dat_SosciSurvey_final$GP_10_pre, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# dat_SosciSurvey_final$GP_11_pre <- recode(dat_SosciSurvey_final$GP_11_pre, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# dat_SosciSurvey_final$GP_12_pre <- recode(dat_SosciSurvey_final$GP_12_pre, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# 
# dat_SosciSurvey_final$GP_01_post <- recode(dat_SosciSurvey_final$GP_01_post, "1=7;2=6;3=5;5=3;6=2;7=1")
# dat_SosciSurvey_final$GP_02_post <- recode(dat_SosciSurvey_final$GP_02_post, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# dat_SosciSurvey_final$GP_03_post <- recode(dat_SosciSurvey_final$GP_03_post, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# dat_SosciSurvey_final$GP_04_post <- recode(dat_SosciSurvey_final$GP_04_post, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# dat_SosciSurvey_final$GP_10_post <- recode(dat_SosciSurvey_final$GP_10_post, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# dat_SosciSurvey_final$GP_11_post <- recode(dat_SosciSurvey_final$GP_11_post, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")
# dat_SosciSurvey_final$GP_12_post <- recode(dat_SosciSurvey_final$GP_12_post, "1=7; 2=6; 3=5; 5=3; 6=2; 7=1")

#mean value pro Participant bilden pre
dat_SosciSurvey_final$mean16pre <- rowMeans(dat_SosciSurvey_final[, c("GP_01_pre", "GP_02_pre", "GP_03_pre", "GP_04_pre", "GP_05_pre", "GP_06_pre", "GP_07_pre", "GP_08_pre", "GP_09_pre", "GP_10_pre", "GP_11_pre", "GP_12_pre", "GP_13_pre", "GP_14_pre", "GP_15_pre", "GP_16_pre")
], na.rm = TRUE)

#mean value pro Participant bilden post
dat_SosciSurvey_final$mean16post <- rowMeans(dat_SosciSurvey_final[, c("GP_01_post", "GP_02_post", "GP_03_post", "GP_04_post", "GP_05_post", "GP_06_post", "GP_07_post", "GP_08_post", "GP_09_post", "GP_10_post", "GP_11_post", "GP_12_post", "GP_13_post", "GP_14_post", "GP_15_post", "GP_16_post")], na.rm = TRUE)

#Itembetrachtung post
df_16I<- data.frame(cbind(dat_SosciSurvey_final$GP_01_post,
               dat_SosciSurvey_final$GP_02_post,
               dat_SosciSurvey_final$GP_03_post,
               dat_SosciSurvey_final$GP_04_post,
               dat_SosciSurvey_final$GP_05_post,
               dat_SosciSurvey_final$GP_06_post,
               dat_SosciSurvey_final$GP_07_post,
               dat_SosciSurvey_final$GP_08_post,
               dat_SosciSurvey_final$GP_09_post,
               dat_SosciSurvey_final$GP_10_post,
               dat_SosciSurvey_final$GP_11_post,
               dat_SosciSurvey_final$GP_12_post,
               dat_SosciSurvey_final$GP_13_post,
               dat_SosciSurvey_final$GP_14_post,
               dat_SosciSurvey_final$GP_15_post,
               dat_SosciSurvey_final$GP_16_post))


colnames(df_16I) [1]<-"Job Satisfaction"
colnames(df_16I) [2]<-"Public Services"
colnames(df_16I) [3]<-"Stability"
colnames(df_16I) [4]<-"Environmental Protection"
colnames(df_16I) [5]<-"Full Employment"
colnames(df_16I) [6]<-"Good Life"
colnames(df_16I) [7]<-"Ernergy Rebound"
colnames(df_16I) [8]<-"Environmental Demage"
colnames(df_16I) [9]<-"Development Space"
colnames(df_16I) [10]<-"Techno-fix"
colnames(df_16I) [11]<-"Recovery"
colnames(df_16I) [12]<-"Post-materialism"
colnames(df_16I) [13]<-"Excessive Political Attention"
colnames(df_16I) [14]<-"Income Inequality"
colnames(df_16I) [15]<-"Flawed Welfare Measure"
colnames(df_16I) [16]<-"Governmental Control"

tab_itemscale(df_16I)
Component 1
Row Missings Mean SD Skew Item Difficulty Item Discrimination α if deleted
Job Satisfaction 0.00 % 5.21 1.25 -0.22 0.74 0.77 0.79
Public Services 0.00 % 3.76 1.46 0.69 0.54 0.55 0.80
Stability 0.00 % 3.68 1.39 0.7 0.53 0.49 0.81
Environmental Protection 0.00 % 4.47 1.56 0.01 0.64 0.62 0.80
Full Employment 0.00 % 4.29 1.59 -0.42 0.61 0.15 0.83
Good Life 0.00 % 5.76 1.35 -0.88 0.82 0.64 0.80
Ernergy Rebound 0.00 % 5.24 1.26 -0.96 0.75 0.27 0.82
Environmental Demage 0.00 % 3.79 1.77 -0.05 0.54 0.57 0.80
Development Space 0.00 % 5.56 1.26 -0.72 0.79 0.70 0.80
Techno-fix 0.00 % 5.24 1.44 -0.7 0.75 0.28 0.82
Recovery 0.00 % 4.65 1.15 0.12 0.66 -0.03 0.84
Post-materialism 0.00 % 5.41 1.16 -0.77 0.77 0.17 0.83
Excessive Political Attention 0.00 % 4.29 1.49 -0.19 0.61 0.56 0.80
Income Inequality 0.00 % 5.5 1.29 -1.05 0.79 0.48 0.81
Flawed Welfare Measure 0.00 % 5.47 1.24 -0.29 0.78 0.33 0.82
Governmental Control 0.00 % 4.88 1.12 -0.58 0.70 0.32 0.82
Mean inter-item-correlation=0.221 · Cronbach's α=0.823
#Gruppierung pre
dat_SosciSurvey_final$Position_I16_pre <- case_when(
  dat_SosciSurvey_final$mean16pre < 3 ~ "green growth",
  dat_SosciSurvey_final$mean16pre >= 3 & dat_SosciSurvey_final$mean16pre <= 5  ~ "a-growth",
  dat_SosciSurvey_final$mean16pre > 5 ~ "degrowth",
    TRUE ~ NA_character_)                                         

#Gruppierung post
dat_SosciSurvey_final$Position_I16_post <- case_when(
  dat_SosciSurvey_final$mean16post < 3 ~ "green growth",
  dat_SosciSurvey_final$mean16post >= 3 & dat_SosciSurvey_final$mean16post <= 5  ~ "a-growth",
  dat_SosciSurvey_final$mean16post > 5 ~ "degrowth",
    TRUE ~ NA_character_)
#summary descriptves                                   
summary(dat_SosciSurvey_final[c("mean16pre","mean16post")])
   mean16pre       mean16post   
 Min.   :3.438   Min.   :3.438  
 1st Qu.:4.328   1st Qu.:4.266  
 Median :4.844   Median :4.906  
 Mean   :4.811   Mean   :4.825  
 3rd Qu.:5.109   3rd Qu.:5.344  
 Max.   :6.250   Max.   :6.438  
#frequency dist PRE
ggplot(dat_SosciSurvey_final, aes(x =mean16pre )) +
  geom_histogram( fill = "skyblue", color = "black") +
  labs(x = "Mean Value ", y = "Frequency", title = "16 Item Intrinsic Position Stance Prior Mean") +
  scale_y_continuous(breaks = seq(0, max(y), by = 1))
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

#frequency table of implicit position Prior 
ggplot(dat_SosciSurvey_final, aes(x =Position_I16_pre )) +
  geom_bar( fill = "skyblue", color = "black") +
  labs(x = "Mean Value ", y = "Frequency", title = "16 Item Intrinsic Position Stance Prior") +
  scale_y_continuous(breaks = seq(0, max(y), by = 1))

#frequency dist 
ggplot(dat_SosciSurvey_final, aes(x =mean16post )) +
  geom_histogram( fill = "skyblue", color = "black") +
  labs(x = "Mean Value ", y = "Frequency", title = "16 Item Intrinsic Position Stance Post") +
  scale_y_continuous(breaks = seq(0, max(y), by = 1))
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

#frequency table of gruped implicit position Prior
ggplot(dat_SosciSurvey_final, aes(x =Position_I16_post )) +
  geom_bar( fill = "skyblue", color = "black") +
  labs(x = "Position", y = "Frequency", title = "16 Item Intrinsic Position Stance Post") +
  scale_y_continuous(breaks = seq(0, max(y), by = 1))

#Changers Implicit position

#positon choice pre post change
df_implicit_position <- data.frame(
  case = dat_SosciSurvey_final$CASE_pre,
  Pre = dat_SosciSurvey_final$Position_I16_pre,
  Post = dat_SosciSurvey_final$Position_I16_post
)

df_implicit_position
   case      Pre     Post
1   653 a-growth a-growth
2   654 a-growth a-growth
3   656 degrowth degrowth
4   662 a-growth degrowth
5   664 a-growth degrowth
6   665 degrowth degrowth
7   671 a-growth a-growth
8   673 a-growth degrowth
9   674 a-growth a-growth
10  685 degrowth a-growth
11  686 a-growth degrowth
12  689 degrowth degrowth
13  692 degrowth degrowth
14  698 a-growth a-growth
15  701 degrowth a-growth
16  702 a-growth a-growth
17  707 a-growth a-growth
18  709 a-growth a-growth
19  710 a-growth a-growth
20  724 a-growth a-growth
21  725 a-growth degrowth
22  727 a-growth a-growth
23  732 a-growth a-growth
24  734 a-growth degrowth
25  736 degrowth degrowth
26  741 a-growth a-growth
27  743 degrowth degrowth
28  744 a-growth a-growth
29  749 degrowth degrowth
30  751 a-growth a-growth
31  753 degrowth degrowth
32  758 a-growth a-growth
33  760 a-growth a-growth
34  761 a-growth degrowth
# Vergleich der 'Pre' und 'Post' Spalten und Ausgabe der 'case' Werte, die sich unterscheiden
cases_ip_change <- df_implicit_position[df_implicit_position$Pre != df_implicit_position$Post, "case"]

# Ausgabe der 'case' Werte, die sich unterscheiden
print(cases_ip_change)
[1] 662 664 673 685 686 701 725 734 761
# Ausgabe der Anzahl der Fälle, die sich unterscheiden
anzahl_cases_ip_change <- length(cases_ip_change)
print(anzahl_cases_ip_change)
[1] 9
library(openxlsx)

Attache Paket: 'openxlsx'
Die folgenden Objekte sind maskiert von 'package:xlsx':

    createWorkbook, loadWorkbook, read.xlsx, saveWorkbook, write.xlsx
write.xlsx(df_implicit_position, "outputs/df_implicit_position.xlsx")

Group Input binary

#BD07_post
#Question: Haben Sie die Eingabe am Computer während der Gruppenarbeit übernommen?
#Options: Yes / No
anzahl_groupinput_y <- sum(dat_SosciSurvey_final$BD07_post == "Ja", na.rm = TRUE)
anzahl_groupinput_n <- sum(dat_SosciSurvey_final$BD07_post == "Nein", na.rm = TRUE)


print(anzahl_groupinput_y)
[1] 18
print(anzahl_groupinput_n)
[1] 16

Representativity rating of CAM (IND/Group)

#Question: Inwieweit spiegelt Ihre indivduelle Mind-Map Ihre Einstellungen und Gefühle zu Wirtschaftswachstum und ökologischer Nachhaltigkeit wieder? 
#Options: 7 point scale (1 = Completely unrepresentative to 7 = fully representative)

#Sakala 1 bis 7
#PC06_01_post = Individuell CAM representativity Rating  - PC06_02_post = Gruppen CAM representativity Rating
df_repres<-describe(dat_SosciSurvey_final[c("PC06_01_post", "PC06_02_post")])
rownames(df_repres) [1]<-"representativity Ind"
rownames(df_repres) [2]<-"representativity Group"

df_repres
                       vars  n mean   sd median trimmed  mad min max range
representativity Ind      1 34 5.85 0.86      6    5.89 1.48   4   7     3
representativity Group    2 34 5.53 1.40      6    5.75 0.00   1   7     6
                        skew kurtosis   se
representativity Ind   -0.29    -0.70 0.15
representativity Group -1.54     2.11 0.24
#histogramm Repräsentativität
# Plot frequency distribution X
ggplot(dat_SosciSurvey_final, aes(x = PC06_01_post)) +
  geom_histogram(binwidth = 1, fill = "skyblue", color = "black") +
  labs(x = "Individuell CAM representativity Rating", y = "Frequency", title = "representativity individual") +
  scale_y_continuous(breaks = seq(0, max(y), by = 1))  

#histogramm Repräsentativität
# Plot frequency distribution X
ggplot(dat_SosciSurvey_final, aes(x = PC06_02_post)) +
  geom_histogram(binwidth = 1, fill = "skyblue", color = "black") +
  labs(x = "Group CAM representativity Rating", y = "Frequency", title = "Repres Group") +
  scale_y_continuous(breaks = seq(0, max(y), by = 1))  

#representativity per group
# Durchschnitt und den Standardfehler für PC06_01_post
mean_PC06_01_post <- tapply(dat_SosciSurvey_final$PC06_01_post, dat_SosciSurvey_final$Group, mean)
se_PC06_01_post <- tapply(dat_SosciSurvey_final$PC06_01_post, dat_SosciSurvey_final$Group, function(x) sd(x)/sqrt(length(x)))

# Durchschnitt und den Standardfehler für PC06_02_post
mean_PC06_02_post <- tapply(dat_SosciSurvey_final$PC06_02_post, dat_SosciSurvey_final$Group, mean)
se_PC06_02_post <- tapply(dat_SosciSurvey_final$PC06_02_post, dat_SosciSurvey_final$Group, function(x) sd(x)/sqrt(length(x)))


#differenz berechnen


# Dataframe mit den berechneten Werten

repres_mean_se <- data.frame(
  Gruppe = names(mean_PC06_01_post),
  Mean_PC06_01_post = mean_PC06_01_post,
  SE_PC06_01_post = se_PC06_01_post,
  Mean_PC06_02_post = mean_PC06_02_post,
  SE_PC06_02_post = se_PC06_02_post
  )


repres_mean_se$diff_mean_rep <- repres_mean_se$Mean_PC06_02_post - repres_mean_se$Mean_PC06_01_post



#boxplot
boxplot(dat_SosciSurvey_final$PC06_01_post, dat_SosciSurvey_final$PC06_02_post,
        names = c("PC06_01_post", "PC06_02_post"),
        main = "Boxplot for representativity Ind CAM & representativity Group CAM",
        xlab = "Variablen",
        ylab = "Werte",
        col = c("blue", "red"))

# T-Test 
report(t.test(dat_SosciSurvey_final$PC06_01_post, dat_SosciSurvey_final$PC06_02_post, paired = TRUE))
For paired samples, 'repeated_measures_d()' provides more options.
Effect sizes were labelled following Cohen's (1988) recommendations.

The Paired t-test testing the difference between
dat_SosciSurvey_final$PC06_01_post and dat_SosciSurvey_final$PC06_02_post (mean
difference = 0.32) suggests that the effect is positive, statistically not
significant, and small (difference = 0.32, 95% CI [-0.21, 0.86], t(33) = 1.23,
p = 0.227; Cohen's d = 0.21, 95% CI [-0.13, 0.55])

CAM Relationship rating (IND/Group)

#Example Question: Wie sehr stimmen die positiven (grünen) Konzepte der Mind-Map der Gruppenarbeit mit Ihrer eigenen Mind-Map überein?
#Options: 5 point scale (1 = not at all to 5 = completely)

#Übereinstimmung Einzeln auswerten - PC01_05 PC01_08 PC01_09 PC01_12 PC01_06 PC01_11 PC01_04 PC01_03 
# Skala 1 -5
#PC01_05    Übereinstimmung: Wie sehr stimmen die positiven (grünen) Konzepte der Mind-Map der Gruppenarbeit mit Ihrer eigenen Mind-Map überein?
#PC01_08    Übereinstimmung: Wie sehr stimmen die negativen (roten) Konzepte der Mind-Map der Gruppenarbeit mit Ihrer eigenen Mind-Map überein?
#PC01_09    Übereinstimmung: Wie sehr stimmen die neutralen (gelben) Konzepte der Mind-Map der Gruppenarbeit mit Ihrer eigenen Mind-Map überein?
#PC01_12    Übereinstimmung: Wie sehr stimmen die die ambivalenten (lilalen) Konzepte der Mind-Map der Gruppenarbeit mit Ihrer eigenen Mind-Map überein?
#PC01_06    Übereinstimmung: Wie sehr stimmt die Mind-Map der Gruppenarbeit in Ihren hemmenden Verbindungen zwischen den einzelnen Konzepten mit Ihrer eigenen Mind-Map überein?
#PC01_11    Übereinstimmung: Wie sehr stimmt die Mind-Map der Gruppenarbeit in Ihren verstärkenden Verbindungen zwischen den einzelnen Konzepten mit Ihrer eigenen Mind-Map überein?
#PC01_04    Übereinstimmung: Wie sehr beinhaltet die Mind-Map der Gruppenarbeit die Konzepte Ihrer eigenen Mind-Map?
#PC01_03    Übereinstimmung: Wie sehr stimmt die Mind-Map der Gruppenarbeit insgesamt mit Ihrer eigenen Mind-Map überein?
#PC06_01    Repräsentativität: Inwieweit spiegelt Ihre indivduelle Mind-Map Ihre Einstellungen und Gefühle zu Wirtschaftswachstum und ökologischer Nachhaltigkeit wieder?
#PC06_02    Repräsentativität: Inwieweit spiegelt die Mind-Map aus der Gruppenarbeit Ihre Einstellungen und Gefühle zu Wirtschaftswachstum und ökologischer Nachhaltigkeit wieder?


df_matching_i <- data.frame(cbind(
  dat_SosciSurvey_final$PC01_05,
  dat_SosciSurvey_final$PC01_08,
  dat_SosciSurvey_final$PC01_09,
  dat_SosciSurvey_final$PC01_12,
  dat_SosciSurvey_final$PC01_11,
  dat_SosciSurvey_final$PC01_04,
  dat_SosciSurvey_final$PC01_03
))


colnames(df_matching_i) [1]<-"Positive Concepts"
colnames(df_matching_i) [2]<-"Negative Concepts "
colnames(df_matching_i) [3]<-"Neutral Concepts"
colnames(df_matching_i) [4]<-"Ambivalent Concepts"
colnames(df_matching_i) [5]<-"Dashed Edges"
colnames(df_matching_i) [6]<-"Solid Edges"
colnames(df_matching_i) [7]<-"Overall Attitude Refelction"



tab_itemscale(df_matching_i)
Component 1
Row Missings Mean SD Skew Item Difficulty Item Discrimination α if deleted
Positive Concepts 0.00 % 3.91 0.79 -1 0.78 0.59 0.72
Negative Concepts 0.00 % 3.79 0.88 -0.99 0.76 0.69 0.70
Neutral Concepts 0.00 % 3.68 1.09 -0.78 0.74 0.48 0.75
Ambivalent Concepts 0.00 % 3.26 1.16 -0.68 0.65 0.39 0.77
Dashed Edges 0.00 % 3.91 0.75 -0.75 0.78 0.46 0.75
Solid Edges 0.00 % 3.5 0.66 -0.33 0.70 0.46 0.75
Overall Attitude Refelction 0.00 % 3.29 0.8 -0.22 0.66 0.48 0.74
Mean inter-item-correlation=0.343 · Cronbach's α=0.769

Intragroup Conflict Scale (ICS)

# Task Conflict

#PC02_01 PC02_02 PC02_03 PC02_08 PC02_04 PC02_05 PC02_06 PC02_07 8 Items erhoben 6 verwenden
#Item analysis
df_ICS_Task <- data.frame(cbind(
  dat_SosciSurvey_final$PC02_04_post,
  dat_SosciSurvey_final$PC02_05_post,
  dat_SosciSurvey_final$PC02_06_post))


tab_itemscale(df_ICS_Task)
Component 1
Row Missings Mean SD Skew Item Difficulty Item Discrimination α if deleted
X1 0.00 % 1.88 1.04 1.29 0.38 0.60 0.46
X2 0.00 % 2.35 1.18 1.03 0.39 0.68 0.33
X3 0.00 % 1.44 0.61 1.08 0.48 0.33 0.79
Mean inter-item-correlation=0.416 · Cronbach's α=0.690
#Relationship COnflict
df_ICS_Rela <- data.frame(cbind(
  dat_SosciSurvey_final$PC02_01_post,
  dat_SosciSurvey_final$PC02_02_post,
  dat_SosciSurvey_final$PC02_03_post))


tab_itemscale(df_ICS_Rela)
Component 1
Row Missings Mean SD Skew Item Difficulty Item Discrimination α if deleted
X1 0.00 % 1.62 0.74 1.24 0.40 0.49 0.48
X2 0.00 % 1.21 0.59 3.66 0.30 0.33 0.68
X3 0.00 % 1.26 0.67 2.92 0.32 0.54 0.40
Mean inter-item-correlation=0.365 · Cronbach's α=0.636
#Task Conflict //PC02_04_post, PC02_05_post, PC02_06_post
dat_SosciSurvey_final$ICS_Task_mean <- rowMeans(dat_SosciSurvey_final[, c("PC02_04_post", "PC02_05_post", "PC02_06_post")], na.rm = TRUE)

#Relationship conflict //PC02_01_post, PC02_02_post, PC02_03_post
dat_SosciSurvey_final$ICS_Relat_mean <- rowMeans(dat_SosciSurvey_final[, c("PC02_01_post", "PC02_02_post", "PC02_03_post")], na.rm = TRUE)

#all values
describe(dat_SosciSurvey_final[c("ICS_Relat_mean", "ICS_Task_mean")])
               vars  n mean   sd median trimmed  mad min  max range skew
ICS_Relat_mean    1 34 1.36 0.51   1.33    1.27 0.49   1 3.33  2.33 1.95
ICS_Task_mean     2 34 1.89 0.76   1.67    1.82 0.49   1 4.00  3.00 0.80
               kurtosis   se
ICS_Relat_mean     4.39 0.09
ICS_Task_mean     -0.02 0.13
#value per group

grouped_ICS <- by(dat_SosciSurvey_final, dat_SosciSurvey_final$Group, function(x) describe(x[c("ICS_Relat_mean", "ICS_Task_mean")]))

# converting
ics_grouped <- do.call(rbind, grouped_ICS)

# new row for group
ics_grouped$Group <- rownames(grouped_ICS)

Own items + Electoral question

Satisfaction with the result of the group work

#Question 1:  Ich bin mit dem Ergebnis der Gruppenarbeit zufrieden.
#Question 2:  Ich würde das Ergebnis der Gruppenarbeit gerne verändern.
#Options: 5 point scale (1 = not at all to 5 = completely)


#Zufriedenheit mit Ergebnis der Gruppenarbeit  PC03_01_post PC03_02_post (Gegenfrage - invertieren) 
#summenscore nach Invertieren von PC03_02_post bilden (satisfaction)
dat_SosciSurvey_final$PC03_02_post<- recode(dat_SosciSurvey_final$PC03_02_post, "1=5;2=4;4=2;5=1")
dat_SosciSurvey_final$satis_group_mean <- dat_SosciSurvey_final$PC03_02_post + dat_SosciSurvey_final$PC03_01_post /2

df_satisfaction <- data.frame(dat_SosciSurvey_final$PC03_01_post,dat_SosciSurvey_final$PC03_02_post)
colnames(df_satisfaction) <- c("Satisfaction", "Change Intention")  

tab_itemscale(df_satisfaction)
Warning: Data frame needs at least three columns for reliability-test.
Component 1
Row Missings Mean SD Skew Item Difficulty Item Discrimination α if deleted
Satisfaction 0.00 % 4.26 0.83 -1.23 0.85 NA NA
Change Intention 0.00 % 4.09 1.11 -1.17 0.82 NA NA
Mean inter-item-correlation=0.765 · Cronbach's α=0.846
#Sataisfaction per Group
grouped_satis <- by(dat_SosciSurvey_final, dat_SosciSurvey_final$Group, function(x) describe(x$satis_group_mean))
satis_grouped <- do.call(rbind, grouped_satis)
satis_grouped$Group <- rownames(grouped_satis)

Learned something new by Group work

#Question:   Ich habe durch die Gruppenarbeit neues gelernt.
#Options: 5 point scale (1 = not at all to 5 = completely)


#neues gelernt PC03_04
describe(dat_SosciSurvey_final$PC03_04_post)
   vars  n mean   sd median trimmed  mad min max range skew kurtosis  se
X1    1 34 3.12 1.17      3    3.07 1.48   1   5     4 0.22    -1.32 0.2

Experience positive / negative Group CAM

#Question:  Die Gruppenarbeit empfand ich als positiv.
#Options: 5 point scale (1 = not at all to 5 = completely)

# Erfarhung positiv Gruppencam PC03_06  5 point scale
describe(dat_SosciSurvey_final$PC03_06_post)
   vars  n mean  sd median trimmed  mad min max range  skew kurtosis   se
X1    1 34 4.29 0.8      4    4.39 1.48   2   5     3 -0.89      0.1 0.14
#Question:  Die Gruppenarbeit empfand ich als negativ.
#Options: 5 point scale (1 = not at all to 5 = completely)
# Erfarhung negativ PC03_07
describe(dat_SosciSurvey_final$PC03_07_post)
   vars  n mean   sd median trimmed mad min max range skew kurtosis   se
X1    1 34 1.18 0.63      1       1   0   1   4     3 3.47    11.36 0.11
# Erfahrung kombiniert
#| results: asis
df_experience <- data.frame(dat_SosciSurvey_final$PC03_06_post,dat_SosciSurvey_final$PC03_07_post)
colnames(df_experience) <- c("Positive_Experience", "Negative_Experience")  
df_experience$Negative_Experience <- recode(df_experience$Negative_Experience,"1=5;2=4;4=2;5=1")
tab_itemscale(df_experience)
Warning: Data frame needs at least three columns for reliability-test.
Component 1
Row Missings Mean SD Skew Item Difficulty Item Discrimination α if deleted
Positive_Experience 0.00 % 4.29 0.8 -0.98 0.86 NA NA
Negative_Experience 0.00 % 4.82 0.63 -3.8 0.96 NA NA
Mean inter-item-correlation=0.592 · Cronbach's α=0.730

Attitude change / attitude reinforcement

#Einstellungsänderung PC03_08 
#Question: Meine Einstellung zu Wirtschaftswachstum und ökologischer Nachhaltigkeit hat sich durch die Gruppenarbeit verändert. 
#Options: 5 point scale (1 = not at all to 5 = completely
tmp_change<- describe(dat_SosciSurvey_final$PC03_08_post)
rownames(tmp_change) [1]<-"Opinion Change"
tmp_change
               vars  n mean sd median trimmed  mad min max range skew kurtosis
Opinion Change    1 34 2.03  1      2    1.93 1.48   1   4     3 0.65     -0.7
                 se
Opinion Change 0.17
# PC03_09 Bestärkung
#Questin: Die Gruppenarbeit hat mich in meiner Einstellung zu Wirtschaftswachstum und ölologischer Nachhaltigkeit bestärkt.
#Options: 5 point scale (1 = not at all to 5 = completely
tmp_reinfore<- describe(dat_SosciSurvey_final$PC03_09_post)
rownames(tmp_reinfore) [1]<-"Opinion Reinforcement"
tmp_reinfore
                      vars  n mean   sd median trimmed mad min max range  skew
Opinion Reinforcement    1 34 3.74 0.62      4    3.75   0   2   5     3 -0.54
                      kurtosis   se
Opinion Reinforcement      0.4 0.11

Equal Partizipation

# Partizipation PC03_10_post
#Question: Die Teilnehmenden haben sich bei der Gruppenarbeit gleichermaßen eingebracht.
#Options: 5 point scale (1 = not at all to 5 = completely
tmp_participation<- describe(dat_SosciSurvey_final$PC03_10_post)
rownames(tmp_participation) [1]<-"Participation"
tmp_participation
              vars  n mean   sd median trimmed  mad min max range  skew
Participation    1 34 3.74 0.96      4    3.82 1.48   1   5     4 -0.66
              kurtosis   se
Participation     0.24 0.17

Familarity Group Members

#familarity PC03_11_post
#Question: Ich kannte mindestens eine/n der Teilnehmenden meiner Gruppe zuvor.
#Options:  5 point scale (1 = not at all to 5 = completely
tmp_familarity<- describe(dat_SosciSurvey_final$PC03_11_post)
rownames(tmp_familarity) [1]<-"Familarity"
tmp_familarity
           vars  n mean   sd median trimmed  mad min max range skew kurtosis
Familarity    1 34 2.91 1.85      3    2.89 2.97   1   5     4 0.04     -1.9
             se
Familarity 0.32

Election Choice

#Sonntagsfrage PO01
absolut <-table(dat_SosciSurvey_final$PO01_post)
relh<- round(prop.table(table(dat_SosciSurvey_final$PO01_post))*100,2)
round(prop.table(table(dat_SosciSurvey_final$PO01_post))*100,2)

                   AfD                CDU/CSU              Die Linke 
                  0.00                   2.94                   5.88 
                   FDP  Bündnis 90/Die Grünen                    SPD 
                  0.00                  79.41                   5.88 
                Andere Ich würde nicht wählen [NA] nicht beantwortet 
                  2.94                   2.94                   0.00 
kumh<- round(prop.table(table(dat_SosciSurvey_final$PO01_post))*100,2)

sonn_table <- cbind(absolut,relh,kumh)

CAM Analyse Quantitative

Network Indicators Overall

networkIndicators_indGroup$group <- str_remove(string = networkIndicators_indGroup$CAM_ID, pattern = "_[:digit:]{1,3}")
table(networkIndicators_indGroup$group)

     group individual 
        11         34 
nw_gesamt<-d<-describeBy(networkIndicators_indGroup[,c("mean_valence_macro", "num_nodes_macro","num_nodes_pos_macro","num_nodes_neg_macro","num_nodes_ambi_macro","num_nodes_neut_macro","num_edges_macro","num_edges_solid_macro","num_edges_dashed_macro","density_macro")],networkIndicators_indGroup$group,mat = TRUE) 

#data frame für deskriptive
individual =c(nw_gesamt[2,5],nw_gesamt[4,5],nw_gesamt[6,5],nw_gesamt[8,5],nw_gesamt[10,5],nw_gesamt[12,5],nw_gesamt[14,5],nw_gesamt[16,5],nw_gesamt[18,5],nw_gesamt[20,5]) #Reihenfolge: Mean Valence/Nodes ALL/Nodes Pos/Nodes Neg/Nodes Ambi/Nodes neutral/num edges/num edges solid/num edges dashed/density
group = c(nw_gesamt[1,5],nw_gesamt[3,5],nw_gesamt[5,5],nw_gesamt[7,5],nw_gesamt[9,5],nw_gesamt[11,5],nw_gesamt[13,5],nw_gesamt[15,5],nw_gesamt[17,5],nw_gesamt[19,5])

SE1=c(nw_gesamt[2,15],nw_gesamt[4,15],nw_gesamt[6,15],nw_gesamt[8,15],nw_gesamt[10,15],nw_gesamt[12,15],nw_gesamt[14,15],nw_gesamt[16,15],nw_gesamt[18,15],nw_gesamt[20,15])


SE2 =c(nw_gesamt[1,15],nw_gesamt[3,15],nw_gesamt[5,15],nw_gesamt[7,15],nw_gesamt[9,15],nw_gesamt[11,15],nw_gesamt[13,15],nw_gesamt[15,15],nw_gesamt[17,15],nw_gesamt[19,15])


network_indicators<- data.frame(individual,SE1,group, SE2)
row.names(network_indicators)<-c("Valence","NodesAll","NodesPos","NodesNeg","NodesAmbi","NodesNeutral","NumEdges","numedgessolid","numedgesdashed","density")
                             
#Difference berchnen                 
network_indicators$Difference<- network_indicators$group - network_indicators$individual



#APA Table aus Deskriptive
library(rempsyc)
Suggested APA citation: Thériault, R. (2023). rempsyc: Convenience functions for psychology. 
Journal of Open Source Software, 8(87), 5466. https://doi.org/10.21105/joss.05466
network_indicators<-cbind(Network_Parameter = row.names(network_indicators), network_indicators)
                           
APA_Descriptives_T1<-nice_table(network_indicators,
                                title=c("Table1","Network Indicators"),
                                note = c("all values mean"))

print(APA_Descriptives_T1, preview = "docx")
a flextable object.
col_keys: `Network_Parameter`, `individual`, `SE1`, `group`, `SE2`, `Difference` 
header has 3 row(s) 
body has 10 row(s) 
original dataset sample: 
          Network_Parameter individual       SE1      group        SE2
Valence             Valence  0.3388707 0.1198807  0.4310502 0.09857439
NodesAll           NodesAll 13.4117647 0.4834473 16.3636364 2.05502810
NodesPos           NodesPos  6.1176471 0.4522960  7.3636364 1.01150408
NodesNeg           NodesNeg  4.0294118 0.4274146  4.3636364 0.76601362
NodesAmbi         NodesAmbi  1.3823529 0.2313053  3.3636364 0.62191387
          Difference
Valence   0.09217955
NodesAll  2.95187166
NodesPos  1.24598930
NodesNeg  0.33422460
NodesAmbi 1.98128342
# Test zwischen Group und IND
#?Matched Data zunächst erzeugen

#wilcox.test(networkIndicators_individual$mean_valence_macro, networkIndicators_group$mean_valence_macro, paired = TRUE)

Neighborhood Indicators Central Concepts

#Group
tmp_microIndicator <- c("Wirtschaftswachstum", "Ökologische Nachhaltigkeit")
neighborhood_networkIndicators_group <- compute_neighborhoodIndicatorsCAM(drawn_CAM = CAMdrawn_group,
    weightSecondOrder = .5,
    consideredConcepts = tmp_microIndicator,
    sliceCAMbool = TRUE,
    removeConnectionCAM = tmp_microIndicator,
    removeNodeCAM = NULL)
Warning: `are.connected()` was deprecated in igraph 2.0.0.
ℹ Please use `are_adjacent()` instead.
#overall group
mean_group_neighbour_ww <- mean(neighborhood_networkIndicators_group$mean_1_Wirtschaftswachstum, na.rm = TRUE)

se_group_neighbour_ww <- sd(neighborhood_networkIndicators_group$mean_1_Wirtschaftswachstum, na.rm = TRUE) / sqrt(length(neighborhood_networkIndicators_group$mean_1_Wirtschaftswachstum))


mean_group_neighbour_Ecol<- mean(neighborhood_networkIndicators_group$mean_1_ÖkologischeNachhaltigkeit, na.rm = TRUE)

se_group_neighbour_Ecol <- sd(neighborhood_networkIndicators_group$mean_1_ÖkologischeNachhaltigkeit, na.rm = TRUE) / sqrt(length(neighborhood_networkIndicators_group$mean_1_ÖkologischeNachhaltigkeit))

list(
  mean_group_neighbour_ww,
  se_group_neighbour_ww,
  mean_group_neighbour_Ecol,
  se_group_neighbour_Ecol
)
[[1]]
[1] 0.2695133

[[2]]
[1] 0.2093708

[[3]]
[1] 0.8503345

[[4]]
[1] 0.2613787
#Individual
tmp_microIndicator <- c("Wirtschaftswachstum", "Ökologische Nachhaltigkeit")
neighborhood_networkIndicators_ind <- compute_neighborhoodIndicatorsCAM(drawn_CAM = CAMdrawn_individual,
    weightSecondOrder = .5,
    consideredConcepts = tmp_microIndicator,
    sliceCAMbool = TRUE,
    removeConnectionCAM = tmp_microIndicator,
    removeNodeCAM = NULL)

#overall individual 

mean_ind_neighbour_ww <- mean(neighborhood_networkIndicators_ind$mean_1_Wirtschaftswachstum, na.rm = TRUE)

se_ind_neighbour_ww <- sd(neighborhood_networkIndicators_ind$mean_1_Wirtschaftswachstum, na.rm = TRUE) / sqrt(length(neighborhood_networkIndicators_ind$mean_1_Wirtschaftswachstum))


mean_ind_neighbour_Ecol<- mean(neighborhood_networkIndicators_ind$mean_1_ÖkologischeNachhaltigkeit, na.rm = TRUE)

se_ind_neighbour_Ecol <- sd(neighborhood_networkIndicators_ind$mean_1_ÖkologischeNachhaltigkeit, na.rm = TRUE) / sqrt(length(neighborhood_networkIndicators_ind$mean_1_ÖkologischeNachhaltigkeit))

list(
  mean_ind_neighbour_ww,
  se_ind_neighbour_ww,
  mean_ind_neighbour_Ecol,
  se_ind_neighbour_Ecol
)
[[1]]
[1] 0.09303221

[[2]]
[1] 0.1460753

[[3]]
[1] 0.8297757

[[4]]
[1] 0.1515264

Valence central concepts

Indvidual

#Wirtschaftswachstum Individual
# Verwenden von lapply(), um die Spalte 'Spaltenname' aus jedem Listenelement zu extrahieren
partCAM <- lapply(CAMfiles_indGroup, function(x) x[["participantCAM"]])
textnodes <- lapply(CAMfiles_indGroup, function(x) x[["text"]])
valuenodes <- lapply(CAMfiles_indGroup, function(x) x[["value"]])

#erstelle einen Data Frame der alle nodes mit dem text Wirtschaftswachstum der Ind CAMs enthält
# Erstellen eines leeren Data Frames für das Ergebnis
wwvalence_df <- data.frame(creator = character(), text = character(), value = numeric(), stringsAsFactors = FALSE)

# Durchlaufen der Liste raw_CAM_individual
for(i in 1:34) {
  # Zugriff auf die 'nodes' und 'creator' des aktuellen Elements
  nodes <- raw_CAM_individual[[i]][["nodes"]]
  creator <- raw_CAM_individual[[i]][["creator"]]
  
  # Überprüfen, ob 'text' und 'value' vorhanden sind
  if("text" %in% names(nodes) && "value" %in% names(nodes)) {
    # Anwenden des subset-Befehls, um nur die Zeilen mit "Wirtschaftswachstum" zu erhalten
    subset_nodes <- subset(nodes, text == "Wirtschaftswachstum")
    
    # Hinzufügen der 'creator'-Information zu den gefilterten Daten
    subset_nodes$creator <- creator
    
    # Hinzufügen der gefilterten Daten zum Ergebnis-Data Frame
    wwvalence_df <- rbind(wwvalence_df, subset_nodes[, c("creator", "text", "value")])
  }
}

# Ausgabe des Ergebnis-Data Frames
wwvalence_df
           creator                text value
2   individual_674 Wirtschaftswachstum     0
21  individual_671 Wirtschaftswachstum     0
22  individual_673 Wirtschaftswachstum    10
23  individual_736 Wirtschaftswachstum     0
24  individual_724 Wirtschaftswachstum    10
25  individual_732 Wirtschaftswachstum    10
26  individual_727 Wirtschaftswachstum     0
27  individual_734 Wirtschaftswachstum    -2
28  individual_725 Wirtschaftswachstum     0
29  individual_741 Wirtschaftswachstum     0
210 individual_744 Wirtschaftswachstum    10
211 individual_743 Wirtschaftswachstum    -3
212 individual_654 Wirtschaftswachstum     0
213 individual_653 Wirtschaftswachstum    10
214 individual_656 Wirtschaftswachstum     0
215 individual_753 Wirtschaftswachstum    10
216 individual_709 Wirtschaftswachstum     1
217 individual_751 Wirtschaftswachstum     0
218 individual_707 Wirtschaftswachstum     0
219 individual_749 Wirtschaftswachstum    -3
220 individual_710 Wirtschaftswachstum     0
221 individual_686 Wirtschaftswachstum    10
222 individual_758 Wirtschaftswachstum     0
223 individual_685 Wirtschaftswachstum     0
224 individual_665 Wirtschaftswachstum     1
225 individual_761 Wirtschaftswachstum     0
226 individual_692 Wirtschaftswachstum     0
227 individual_662 Wirtschaftswachstum    10
228 individual_760 Wirtschaftswachstum     0
229 individual_689 Wirtschaftswachstum     0
230 individual_664 Wirtschaftswachstum    10
231 individual_698 Wirtschaftswachstum     0
232 individual_701 Wirtschaftswachstum     0
233 individual_702 Wirtschaftswachstum     0
#Mean und SE mit 10er Werten als Null berechnen
mean_with_10_as_0 <- function(x) {
  x[x == 10] <- 0
  return(mean(x, na.rm = TRUE))
}
mean_value_with_10_as_0 <- mean_with_10_as_0(wwvalence_df$value)

se_with_10_as_0 <- function(x) {
  x[x == 10] <- 0
  return(sd(x, na.rm = TRUE) / sqrt(length(x)))
}
se_value_with_10_as_0 <- se_with_10_as_0(wwvalence_df$value)

list(
  mean_value_with_10_as_0,
  se_value_with_10_as_0
)
[[1]]
[1] -0.1764706

[[2]]
[1] 0.1429919
# Filtern der Werte, um den Wert 10 auszuschließen
#gefilterte_values_ohne_10 <- wwvalence_df$value[wwvalence_df$value != 10]

# Berechnen der statistischen Kennzahlen ohne den Wert 10
#mean_value_ohne_10 <- mean(gefilterte_values_ohne_10, na.rm = TRUE)
#sd_value_ohne_10 <- sd(gefilterte_values_ohne_10, na.rm = TRUE)
#min_value_ohne_10 <- min(gefilterte_values_ohne_10, na.rm = TRUE)
#max_value_ohne_10 <- max(gefilterte_values_ohne_10, na.rm = TRUE)

# Ermitteln der Häufigkeit von 10
häufigkeit_von_10 <- sum(wwvalence_df$value == 10, na.rm = TRUE)

# Ausgabe der berechneten Werte und der Häufigkeit von 10
#list(
  #MeanOhne10 = mean_value_ohne_10,
 # SDOhne10 = sd_value_ohne_10,
 # MinOhne10 = min_value_ohne_10,
 # MaxOhne10 = max_value_ohne_10,
 # HäufigkeitVon10 = häufigkeit_von_10
#)
#Ökologische Nachhaltigkeit Individual

# Angenommen, 'large_list' ist Ihre große Liste und 'Spaltenname' ist der Name der Spalte, die Sie abrufen möchten.

# Verwenden von lapply(), um die Spalte 'Spaltenname' aus jedem Listenelement zu extrahieren
partCAM <- lapply(CAMfiles_indGroup, function(x) x[["participantCAM"]])
textnodes <- lapply(CAMfiles_indGroup, function(x) x[["text"]])
valuenodes <- lapply(CAMfiles_indGroup, function(x) x[["value"]])

#erstelle einen Data Frame der alle nodes mit dem text Ökologische Nachhaltigkeit der Ind CAMs enthält
# Erstellen eines leeren Data Frames für das Ergebnis
eco_df <- data.frame(creator = character(), text = character(), value = numeric(), stringsAsFactors = FALSE)

# Durchlaufen der Liste raw_CAM_individual
for(i in 1:34) {
  # Zugriff auf die 'nodes' und 'creator' des aktuellen Elements
  nodes <- raw_CAM_individual[[i]][["nodes"]]
  creator <- raw_CAM_individual[[i]][["creator"]]
  
  # Überprüfen, ob 'text' und 'value' vorhanden sind
  if("text" %in% names(nodes) && "value" %in% names(nodes)) {
    # Anwenden des subset-Befehls, um nur die Zeilen mit " Ökologische Nachhaltigkeit" zu erhalten
    subset_nodes <- subset(nodes, text == "Ökologische Nachhaltigkeit")
    
    # Hinzufügen der 'creator'-Information zu den gefilterten Daten
    subset_nodes$creator <- creator
    
    # Hinzufügen der gefilterten Daten zum Ergebnis-Data Frame
    eco_df <- rbind(eco_df, subset_nodes[, c("creator", "text", "value")])
  }
}

# Ausgabe des Ergebnis-Data Frames
eco_df
          creator                       text value
1  individual_674 Ökologische Nachhaltigkeit     0
2  individual_671 Ökologische Nachhaltigkeit     0
3  individual_673 Ökologische Nachhaltigkeit     3
4  individual_736 Ökologische Nachhaltigkeit     0
5  individual_724 Ökologische Nachhaltigkeit     3
6  individual_732 Ökologische Nachhaltigkeit     3
7  individual_727 Ökologische Nachhaltigkeit     0
8  individual_734 Ökologische Nachhaltigkeit     3
9  individual_725 Ökologische Nachhaltigkeit     0
10 individual_741 Ökologische Nachhaltigkeit     0
11 individual_744 Ökologische Nachhaltigkeit     3
12 individual_743 Ökologische Nachhaltigkeit     3
13 individual_654 Ökologische Nachhaltigkeit     0
14 individual_653 Ökologische Nachhaltigkeit     3
15 individual_656 Ökologische Nachhaltigkeit     3
16 individual_753 Ökologische Nachhaltigkeit     3
17 individual_709 Ökologische Nachhaltigkeit     3
18 individual_751 Ökologische Nachhaltigkeit     0
19 individual_707 Ökologische Nachhaltigkeit     0
20 individual_749 Ökologische Nachhaltigkeit     3
21 individual_710 Ökologische Nachhaltigkeit     0
22 individual_686 Ökologische Nachhaltigkeit     3
23 individual_758 Ökologische Nachhaltigkeit     0
24 individual_685 Ökologische Nachhaltigkeit     2
25 individual_665 Ökologische Nachhaltigkeit     3
26 individual_761 Ökologische Nachhaltigkeit     0
27 individual_692 Ökologische Nachhaltigkeit     0
28 individual_662 Ökologische Nachhaltigkeit     3
29 individual_760 Ökologische Nachhaltigkeit     0
30 individual_689 Ökologische Nachhaltigkeit     0
31 individual_664 Ökologische Nachhaltigkeit     3
32 individual_698 Ökologische Nachhaltigkeit     0
33 individual_701 Ökologische Nachhaltigkeit     0
34 individual_702 Ökologische Nachhaltigkeit     0
#Mean und SE mit 10er Werten als Null berechnen
mean_with_10_as_0 <- function(x) {
  x[x == 10] <- 0
  return(mean(x, na.rm = TRUE))
}
mean_value_with_10_as_0 <- mean_with_10_as_0(eco_df$value)

se_with_10_as_0 <- function(x) {
  x[x == 10] <- 0
  return(sd(x, na.rm = TRUE) / sqrt(length(x)))
}
se_value_with_10_as_0 <- se_with_10_as_0(eco_df$value)

list(
  mean_value_with_10_as_0,
  se_value_with_10_as_0
)
[[1]]
[1] 1.382353

[[2]]
[1] 0.2568655
# Filtern der Werte, um den Wert 10 auszuschließen
#gefilterte_values_ohne_10 <- eco_df$value[eco_df$value != 10]

# Berechnen der statistischen Kennzahlen ohne den Wert 10
#mean_value_ohne_10 <- mean(gefilterte_values_ohne_10, na.rm = TRUE)
#sd_value_ohne_10 <- sd(gefilterte_values_ohne_10, na.rm = TRUE)
#min_value_ohne_10 <- min(gefilterte_values_ohne_10, na.rm = TRUE)
#max_value_ohne_10 <- max(gefilterte_values_ohne_10, na.rm = TRUE)

# Ermitteln der Häufigkeit von 10
häufigkeit_von_10 <- sum(eco_df$value == 10, na.rm = TRUE)

# Ausgabe der berechneten Werte und der Häufigkeit von 10
#list(
# MeanOhne10 = mean_value_ohne_10,
#  SDOhne10 = sd_value_ohne_10,
#  MinOhne10 = min_value_ohne_10,
#  MaxOhne10 = max_value_ohne_10,
#  HäufigkeitVon10 = häufigkeit_von_10
#)

Group

#Wirtschaftswachstum Group
# Verwenden von lapply(), um die Spalte 'Spaltenname' aus jedem Listenelement zu extrahieren
partCAM <- lapply(CAMfiles_indGroup, function(x) x[["participantCAM"]])
textnodes <- lapply(CAMfiles_indGroup, function(x) x[["text"]])
valuenodes <- lapply(CAMfiles_indGroup, function(x) x[["value"]])

#erstelle einen Data Frame der alle nodes mit dem text Wirtschaftswachstum der Ind CAMs enthält
# Erstellen eines leeren Data Frames für das Ergebnis
wwvalence_df_g <- data.frame(creator = character(), text = character(), value = numeric(), stringsAsFactors = FALSE)

# Durchlaufen der Liste raw_CAM_group
for(i in 1:11) {
  # Zugriff auf die 'nodes' und 'creator' des aktuellen Elements
  nodes <- raw_CAM_group[[i]][["nodes"]]
  creator <- raw_CAM_group[[i]][["creator"]]
  
  # Überprüfen, ob 'text' und 'value' vorhanden sind
  if("text" %in% names(nodes) && "value" %in% names(nodes)) {
    # Anwenden des subset-Befehls, um nur die Zeilen mit "Wirtschaftswachstum" zu erhalten
    subset_nodes <- subset(nodes, text == "Wirtschaftswachstum")
    
    # Hinzufügen der 'creator'-Information zu den gefilterten Daten
    subset_nodes$creator <- creator
    
    # Hinzufügen der gefilterten Daten zum Ergebnis-Data Frame
    wwvalence_df_g <- rbind(wwvalence_df_g, subset_nodes[, c("creator", "text", "value")])
  }
}

# Ausgabe des Ergebnis-Data Frames
wwvalence_df_g
      creator                text value
2   group_700 Wirtschaftswachstum     0
21  group_672 Wirtschaftswachstum     0
22  group_750 Wirtschaftswachstum    10
23  group_708 Wirtschaftswachstum    10
24  group_759 Wirtschaftswachstum     0
25  group_690 Wirtschaftswachstum    -1
26  group_663 Wirtschaftswachstum    10
27  group_733 Wirtschaftswachstum    10
28  group_726 Wirtschaftswachstum    10
29  group_742 Wirtschaftswachstum    10
210 group_657 Wirtschaftswachstum    10
#Mean und SE mit 10er Werten als Null berechnen
mean_with_10_as_0 <- function(x) {
  x[x == 10] <- 0
  return(mean(x, na.rm = TRUE))
}
mean_value_with_10_as_0 <- mean_with_10_as_0(wwvalence_df_g$value)

se_with_10_as_0 <- function(x) {
  x[x == 10] <- 0
  return(sd(x, na.rm = TRUE) / sqrt(length(x)))
}
se_value_with_10_as_0 <- se_with_10_as_0(wwvalence_df_g$value)

list(
  mean_value_with_10_as_0,
  se_value_with_10_as_0
)
[[1]]
[1] -0.09090909

[[2]]
[1] 0.09090909
# Filtern der Werte, um den Wert 10 auszuschließen
#gefilterte_values_ohne_10 <- wwvalence_df_g$value[wwvalence_df_g$value != 10]

# Berechnen der statistischen Kennzahlen ohne den Wert 10
#mean_value_ohne_10 <- mean(gefilterte_values_ohne_10, na.rm = TRUE)
#sd_value_ohne_10 <- sd(gefilterte_values_ohne_10, na.rm = TRUE)
#min_value_ohne_10 <- min(gefilterte_values_ohne_10, na.rm = TRUE)
#max_value_ohne_10 <- max(gefilterte_values_ohne_10, na.rm = TRUE)

# Ermitteln der Häufigkeit von 10
häufigkeit_von_10 <- sum(wwvalence_df_g$value == 10, na.rm = TRUE)

# Ausgabe der berechneten Werte und der Häufigkeit von 10
#list(
#  MeanOhne10 = mean_value_ohne_10,
#  SDOhne10 = sd_value_ohne_10,
#  MinOhne10 = min_value_ohne_10,
#  MaxOhne10 = max_value_ohne_10,
#  HäufigkeitVon10 = häufigkeit_von_10
#)
#Ökologische Nachhaltigkeit

# Angenommen, 'large_list' ist Ihre große Liste und 'Spaltenname' ist der Name der Spalte, die Sie abrufen möchten.

# Verwenden von lapply(), um die Spalte 'Spaltenname' aus jedem Listenelement zu extrahieren
partCAM <- lapply(CAMfiles_indGroup, function(x) x[["participantCAM"]])
textnodes <- lapply(CAMfiles_indGroup, function(x) x[["text"]])
valuenodes <- lapply(CAMfiles_indGroup, function(x) x[["value"]])

#erstelle einen Data Frame der alle nodes mit dem text Ökologische Nachhaltigkeit der Ind CAMs enthält
# Erstellen eines leeren Data Frames für das Ergebnis
eco_df_g <- data.frame(creator = character(), text = character(), value = numeric(), stringsAsFactors = FALSE)

# Durchlaufen der Liste raw_CAM_group
for(i in 1:11) {
  # Zugriff auf die 'nodes' und 'creator' des aktuellen Elements
  nodes <- raw_CAM_group[[i]][["nodes"]]
  creator <- raw_CAM_group[[i]][["creator"]]
  
  # Überprüfen, ob 'text' und 'value' vorhanden sind
  if("text" %in% names(nodes) && "value" %in% names(nodes)) {
    # Anwenden des subset-Befehls, um nur die Zeilen mit " Ökologische Nachhaltigkeit" zu erhalten
    subset_nodes <- subset(nodes, text == "Ökologische Nachhaltigkeit")
    
    # Hinzufügen der 'creator'-Information zu den gefilterten Daten
    subset_nodes$creator <- creator
    
    # Hinzufügen der gefilterten Daten zum Ergebnis-Data Frame
    eco_df_g <- rbind(eco_df_g, subset_nodes[, c("creator", "text", "value")])
  }
}

# Ausgabe des Ergebnis-Data Frames
eco_df_g
     creator                       text value
1  group_700 Ökologische Nachhaltigkeit     0
2  group_672 Ökologische Nachhaltigkeit     0
3  group_750 Ökologische Nachhaltigkeit     3
4  group_708 Ökologische Nachhaltigkeit     2
5  group_759 Ökologische Nachhaltigkeit     0
6  group_690 Ökologische Nachhaltigkeit     3
7  group_663 Ökologische Nachhaltigkeit     3
8  group_733 Ökologische Nachhaltigkeit     3
9  group_726 Ökologische Nachhaltigkeit     3
10 group_742 Ökologische Nachhaltigkeit     3
11 group_657 Ökologische Nachhaltigkeit     3
#Mean und SE mit 10er Werten als Null berechnen
mean_with_10_as_0 <- function(x) {
  x[x == 10] <- 0
  return(mean(x, na.rm = TRUE))
}
mean_value_with_10_as_0 <- mean_with_10_as_0(eco_df_g$value)

se_with_10_as_0 <- function(x) {
  x[x == 10] <- 0
  return(sd(x, na.rm = TRUE) / sqrt(length(x)))
}
se_value_with_10_as_0 <- se_with_10_as_0(eco_df_g$value)

list(
  mean_value_with_10_as_0,
  se_value_with_10_as_0
)
[[1]]
[1] 2.090909

[[2]]
[1] 0.4146092
# Filtern der Werte, um den Wert 10 auszuschließen
#gefilterte_values_ohne_10 <- eco_df_g$value[eco_df_g$value != 10]

# Berechnen der statistischen Kennzahlen ohne den Wert 10
#mean_value_ohne_10 <- mean(gefilterte_values_ohne_10, na.rm = TRUE)
#sd_value_ohne_10 <- sd(gefilterte_values_ohne_10, na.rm = TRUE)
#min_value_ohne_10 <- min(gefilterte_values_ohne_10, na.rm = TRUE)
#max_value_ohne_10 <- max(gefilterte_values_ohne_10, na.rm = TRUE)

# Ermitteln der Häufigkeit von 10
häufigkeit_von_10 <- sum(eco_df_g$value == 10, na.rm = TRUE)

# Ausgabe der berechneten Werte und der Häufigkeit von 10
#list(
#  MeanOhne10 = mean_value_ohne_10,
#  SDOhne10 = sd_value_ohne_10,
#  MinOhne10 = min_value_ohne_10,
#  MaxOhne10 = max_value_ohne_10,
#  HäufigkeitVon10 = häufigkeit_von_10
#)

CAM Analyse Qualitative

Overall Words both groups top 10

#subset first 12 and exclude central concepts - create new data frame
CAMWordlist_ind_t12 <- CAMwordlist_individual %>% slice_head (n=12)
CAMWordlist_ind_t12 <- cbind(CAMWordlist_ind_t12, CAMwordlist_group %>% slice_head (n=12))
CAMWordlist_ind_t12 <- CAMWordlist_ind_t12[-1, ]
CAMWordlist_ind_t12 <- CAMWordlist_ind_t12[-1, ]

rownames(CAMWordlist_ind_t12) <- NULL

CAMWordlist_ind_t12<- subset(CAMWordlist_ind_t12,select= - c(mean_degree,sd_degree,comment_1,comment_2))
CAMWordlist_ind_t12<- subset(CAMWordlist_ind_t12,select= - c(mean_degree,sd_degree,comment_1,comment_2))

#APA Table mit rempsyc
library(rempsyc)
CAMWordlist_ind_t12APA <-nice_table(CAMWordlist_ind_t12,
                                title=c("Table2","Most Words"),
                                note = c("Take a note"))

print(CAMWordlist_ind_t12APA, preview = "docx" )

a flextable object. col_keys: Words, raw, percent, mean_valence, sd_valence, Words.1, raw.1, percent.1, mean_valence.1, sd_valence.1 header has 3 row(s) body has 10 row(s) original dataset sample: Words raw percent mean_valence sd_valence Words.1 raw.1 1 Wohlstand 7 20.59 1.857143 0.8997354 Lebensqualität 5 2 Klimawandel 4 11.76 -3.000000 0.0000000 Wohlstand 4 3 Artenvielfalt 3 8.82 2.333333 1.1547005 neue Technologien 4 4 Kapitalismus 3 8.82 -1.000000 1.7320508 Ausbeutung 3 5 Klimaschutz 3 8.82 2.666667 0.5773503 Bildung 3 percent.1 mean_valence.1 sd_valence.1 1 45.45 2.200000 1.3038405 2 36.36 1.000000 1.4142136 3 36.36 1.000000 1.1547005 4 27.27 -3.000000 0.0000000 5 27.27 2.666667 0.5773503

stargazer(CAMWordlist_ind_t12, type="html")
Statistic N Mean St. Dev. Min Max
raw 10 3.100 1.524 2 7
percent 10 9.115 4.483 5.880 20.590
mean_valence 10 0.036 2.230 -3.000 2.667
sd_valence 10 0.649 0.555 0.000 1.732
raw.1 10 3.000 1.054 2 5
percent.1 10 27.270 9.582 18.180 45.450
mean_valence.1 10 0.687 2.242 -3.000 3.000
sd_valence.1 10 0.445 0.613 0.000 1.414
dat_SosciSurvey_CAM_final %>%
  group_by(CAM_ID_group) %>%
  summarise(N = n(), mean = mean(PC06_02_post), sd = SD(PC06_02_post))
# A tibble: 11 × 4
   CAM_ID_group     N  mean    sd
   <chr>        <int> <dbl> <dbl>
 1 657              3  5.67 1.53 
 2 663              3  5.67 0.577
 3 672              3  6    0    
 4 690              4  4.5  2.38 
 5 700              3  5    1.73 
 6 708              3  6.67 0.577
 7 726              3  6.33 1.15 
 8 733              3  5.33 1.15 
 9 742              3  4.67 2.31 
10 750              3  6    1    
11 759              3  5.33 1.15 
report(cor(dat_SosciSurvey_CAM_final$PC06_02_post, dat_SosciSurvey_CAM_final$num_nodes_macro_group))
Warning: Variable `cor(dat_SosciSurvey_CAM_final$PC06_02_post,
  dat_SosciSurvey_CAM_final$num_nodes_macro_group)` contains only
  1different values. Consider converting it to a factor.
Warning in sqrt((6 * (n - 2))/((n + 1) * (n + 3))): NaNs wurden erzeugt
x: n = 1, Mean = -0.16, SD = , Median = -0.16, MAD = 0.00, range: [-0.16,
-0.16], Skewness = , Kurtosis = , 0 missing

compare individuals to group

computing three values:

  1. percMatch: Percentage of individual concepts in Group CAM
  2. percMatchValenceType: Percentage of Individual concepts in Group CAM with same affect
  3. percMatchValence: Percentage of Individual concepts in Group CAM with identical valence
setwd("outputs")

list_compareIndGroup <- list()

### create graphics for CAMs
for (i in 1:length(list_ids)) {
  tmp_concepts_ind <-
    CAMfiles_individual[[1]][CAMfiles_individual[[1]]$participantCAM %in% list_ids[[i]]$id_individual, ]
  tmp_concepts_group <-
    CAMfiles_group[[1]][CAMfiles_group[[1]]$participantCAM %in% list_ids[[i]]$id_group, ]
  
  ## add variables individual
  tmp_concepts_ind$type <- "individual"
  
  tmp_concepts_ind$value_group <-
    ifelse(
      test = tmp_concepts_ind$value < 0,
      yes = "negative",
      no = ifelse(
        test = tmp_concepts_ind$value == 0,
        yes = "neutral",
        no = ifelse(
          test = tmp_concepts_ind$value == 10,
          yes = "ambivalent",
          no = ifelse(
            test = tmp_concepts_ind$value > 0 &
              tmp_concepts_ind$value < 10,
            yes = "positive",
            no = "ERROR"
          )
        )
      )
    )
  
  tmp_concepts_ind$percMatch <- 0
  tmp_concepts_ind$percMatchValenceType <- 0
  tmp_concepts_ind$percMatchValence <- 0
  
  
  
  
  
  
  ## add variables group
  tmp_concepts_group$type <- "group"
  
  tmp_concepts_group$value_group <-
    ifelse(
      test = tmp_concepts_group$value < 0,
      yes = "negative",
      no = ifelse(
        test = tmp_concepts_group$value == 0,
        yes = "neutral",
        no = ifelse(
          test = tmp_concepts_group$value == 10,
          yes = "ambivalent",
          no = ifelse(
            test = tmp_concepts_group$value > 0 &
              tmp_concepts_group$value < 10,
            yes = "positive",
            no = "ERROR"
          )
        )
      )
    )
  
  tmp_concepts_group$percMatch <- 0
  tmp_concepts_group$percMatchValenceType <-
    NA # not uniquely defined
  tmp_concepts_group$percMatchValence <- NA # not uniquely defined
  
  
  ## compute matches
  # Percentage of individual concepts in Group CAM
  #> for individual
  tmp_concepts_ind$percMatch[tmp_concepts_ind$text %in% tmp_concepts_group$text] <-
    1
  #> for group
  tmp_concepts_group$percMatch[tmp_concepts_group$text %in% tmp_concepts_ind$text] <-
    1
  
  
  
  
  
  
  for (c in unique(tmp_concepts_ind$CAM)) {
    tmp_concepts_ind_subset <-
      tmp_concepts_ind[tmp_concepts_ind$CAM == c, ]
    
    # Percentage of Individual concepts in Group CAM with same affect
    #> for individual
    tmp_concepts_ind_subset$percMatchValenceType[(tmp_concepts_ind_subset$text %in% tmp_concepts_group$text) &
                                                   (tmp_concepts_ind_subset$value_group %in% tmp_concepts_group$value_group)] <-
      1
    
    tmp_concepts_ind$percMatchValenceType[tmp_concepts_ind$CAM == c] <-
      tmp_concepts_ind_subset$percMatchValenceType
    
    
    # Percentage of Individual concepts in Group CAM with identical valence
    #> for individual
    tmp_concepts_ind_subset$percMatchValence[(tmp_concepts_ind_subset$text %in% tmp_concepts_group$text) &
                                               (tmp_concepts_ind_subset$value %in% tmp_concepts_group$value)] <- 1
    
    tmp_concepts_ind$percMatchValence[tmp_concepts_ind$CAM == c] <-
      tmp_concepts_ind_subset$percMatchValence
    
    
  }
  
  
  
  
  
  
  
  ## get dataset
  tmp_out <-
    rbind(tmp_concepts_ind[, c(
      "type",
      "participantCAM",
      "id",
      "text",
      "value",
      "comment",
      "percMatch",
      "percMatchValenceType",
      "percMatchValence"
    )],
    tmp_concepts_group[, c(
      "type",
      "participantCAM",
      "id",
      "text",
      "value",
      "comment",
      "percMatch",
      "percMatchValenceType",
      "percMatchValence"
    )])
  
  
  
  list_compareIndGroup[[i]] <- tmp_out
}


## add values to socio data.frame
dat_SosciSurvey$percMatch <- NA
dat_SosciSurvey$percMatchValenceType <- NA
dat_SosciSurvey$percMatchValence <- NA


counter <- 1

for(i in 1:length(list_compareIndGroup)){
  for(c in unique(list_compareIndGroup[[i]]$participantCAM)){
    if(unique(list_compareIndGroup[[i]][list_compareIndGroup[[i]]$participantCAM == c,]$type) != "group"){
      tmp <- list_compareIndGroup[[i]][list_compareIndGroup[[i]]$participantCAM == c,]
     
      dat_SosciSurvey$percMatch[dat_SosciSurvey$CASE == unique(tmp$participantCAM)] <- sum(tmp$percMatch) / nrow(tmp)
      dat_SosciSurvey$percMatchValenceType[dat_SosciSurvey$CASE == unique(tmp$participantCAM)] <- sum(tmp$percMatchValenceType) / nrow(tmp)
      dat_SosciSurvey$percMatchValence[dat_SosciSurvey$CASE == unique(tmp$participantCAM)] <- sum(tmp$percMatchValence) / nrow(tmp)
      
      counter = counter + 1
    }
  }
}


sum(!is.na(dat_SosciSurvey$percMatch))
[1] 34
counter
[1] 35
dat_SosciSurvey[, c("CASE" , "percMatch", "percMatchValenceType", "percMatchValence")]
    CASE percMatch percMatchValenceType percMatchValence
653  653 0.4000000           0.40000000       0.30000000
654  654 0.1818182           0.00000000       0.00000000
656  656 0.1538462           0.07692308       0.07692308
657  657        NA                   NA               NA
658  658        NA                   NA               NA
659  659        NA                   NA               NA
660  660        NA                   NA               NA
662  662 0.1538462           0.15384615       0.15384615
663  663        NA                   NA               NA
664  664 0.2000000           0.20000000       0.20000000
665  665 0.2857143           0.28571429       0.21428571
667  667        NA                   NA               NA
668  668        NA                   NA               NA
669  669        NA                   NA               NA
671  671 0.2142857           0.21428571       0.21428571
672  672        NA                   NA               NA
673  673 0.1538462           0.15384615       0.15384615
674  674 0.3600000           0.36000000       0.36000000
679  679        NA                   NA               NA
680  680        NA                   NA               NA
681  681        NA                   NA               NA
685  685 0.2857143           0.07142857       0.07142857
686  686 0.4285714           0.42857143       0.42857143
689  689 0.2500000           0.12500000       0.12500000
690  690        NA                   NA               NA
692  692 0.3529412           0.23529412       0.23529412
693  693        NA                   NA               NA
694  694        NA                   NA               NA
695  695        NA                   NA               NA
696  696        NA                   NA               NA
698  698 0.3076923           0.30769231       0.30769231
700  700        NA                   NA               NA
701  701 0.3846154           0.38461538       0.38461538
702  702 0.2142857           0.21428571       0.21428571
703  703        NA                   NA               NA
704  704        NA                   NA               NA
705  705        NA                   NA               NA
707  707 0.6000000           0.60000000       0.60000000
708  708        NA                   NA               NA
709  709 0.1764706           0.17647059       0.11764706
710  710 0.2000000           0.20000000       0.20000000
711  711        NA                   NA               NA
712  712        NA                   NA               NA
713  713        NA                   NA               NA
724  724 0.3076923           0.30769231       0.30769231
725  725 0.1666667           0.00000000       0.00000000
726  726        NA                   NA               NA
727  727 0.2666667           0.13333333       0.13333333
728  728        NA                   NA               NA
729  729        NA                   NA               NA
730  730        NA                   NA               NA
732  732 0.2727273           0.27272727       0.27272727
733  733        NA                   NA               NA
734  734 0.3076923           0.30769231       0.30769231
736  736 0.5384615           0.53846154       0.46153846
737  737        NA                   NA               NA
738  738        NA                   NA               NA
739  739        NA                   NA               NA
741  741 0.3333333           0.16666667       0.08333333
742  742        NA                   NA               NA
743  743 0.1538462           0.15384615       0.15384615
744  744 0.5000000           0.50000000       0.50000000
745  745        NA                   NA               NA
746  746        NA                   NA               NA
747  747        NA                   NA               NA
749  749 0.3076923           0.30769231       0.23076923
750  750        NA                   NA               NA
751  751 0.1176471           0.00000000       0.00000000
753  753 0.4000000           0.40000000       0.30000000
754  754        NA                   NA               NA
755  755        NA                   NA               NA
756  756        NA                   NA               NA
758  758 0.2500000           0.25000000       0.25000000
759  759        NA                   NA               NA
760  760 0.2142857           0.21428571       0.21428571
761  761 0.3076923           0.30769231       0.30769231
763  763        NA                   NA               NA
764  764        NA                   NA               NA
766  766        NA                   NA               NA
## save Sosci Survey
xlsx::write.xlsx2(x = dat_SosciSurvey, file = "dat_SosciSurvey_percentages.xlsx")
write.csv2(x = dat_SosciSurvey, file = "dat_SosciSurvey_percentages.csv")
saveRDS(object = dat_SosciSurvey, file = "dat_SosciSurvey_percentages.rds")