Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# COMPUTE sum scores and means for A2, A3, B1, B2, C1, D1, D2, E1, E2, G1, G5, G7
# Run Factor analysis on all likert scale items
## OLD R CODE
setwd("~/Seafile/FragebogenMpg")
file1 = read.csv("20200106_MPG Work Culture_Basic Data_likert.csv",header=TRUE,sep=";")
library(psych)
library(umx)
library(ggplot2)
library(Hmisc)
file1$H1_gender <- as.factor(file1$H1_gender)
scale_a <- subset(file1, select = A2_groupatmo1_1:A3_groupatmo4_3)
umxEFA(file1, factors = 19, scores= "ML")
print(class(file1[[i]]))
for (i in colnames(file1)){
p <- ggplot(file1, aes(x=c("all"),
y=file1[[i]]))
+ geom_violin(trim=FALSE)
data_summary <- function(x) {
m <- mean(x)
ymin <- m-sd(x)
ymax <- max(x)
return(c(y=m,ymin=ymin,ymax=ymax))
}
p + stat_summary(fun.data=data_summary)
p <- ggplot(file1, aes(x=file1$H1_gender,
y=file1[[i]], fill=file1$H1_gender))
+ geom_violin(trim=FALSE)
data_summary <- function(x) {
m <- mean(x)
ymin <- m-sd(x)
ymax <- max(x)
return(c(y=m,ymin=ymin,ymax=ymax))
}
p + stat_summary(fun.data=data_summary)
p <- ggplot(file1, aes(x=file1$H1_gender,
y=file1[[i]], fill=file1$startlanguage))
+ geom_violin(trim=FALSE)
data_summary <- function(x) {
m <- mean(x)
ymin <- m-sd(x)
ymax <- max(x)
return(c(y=m,ymin=ymin,ymax=ymax))
}
p + stat_summary(fun.data=data_summary)
}