library(foreign, pos = 4)
library(Rcmdr)
## Loading required package: splines
## The Commander GUI is launched only in interactive sessions
library(psych)
investigacion <- read.spss("D:/cosas/Facultad/2014/investigación/baseLimpia.sav",
use.value.labels = FALSE, to.data.frame = TRUE)
investigacion$p4 <- ifelse(investigacion$p4 > 0, c(0), c(1))
investigacion$p7 <- ifelse(investigacion$p7 > 0, c(0), c(1))
investigacion$p11 <- ifelse(investigacion$p11 > 0, c(0), c(1))
investigacion$p15 <- ifelse(investigacion$p15 > 0, c(0), c(1))
investigacion$p16 <- ifelse(investigacion$p16 > 0, c(0), c(1))
investigacion$p20 <- ifelse(investigacion$p20 > 0, c(0), c(1))
investigacion$p21 <- ifelse(investigacion$p21 > 0, c(0), c(1))
investigacion$p28 <- ifelse(investigacion$p28 > 0, c(0), c(1))
investigacion$p33 <- ifelse(investigacion$p33 > 0, c(0), c(1))
investigacion$p43 <- ifelse(investigacion$p43 > 0, c(0), c(1))
investigacion$p44 <- ifelse(investigacion$p44 > 0, c(0), c(1))
investigacion$p45 <- ifelse(investigacion$p45 > 0, c(0), c(1))
investigacion$actividad <- investigacion$p1 + investigacion$p5 + investigacion$p12 +
investigacion$p16 + investigacion$p21 + investigacion$p25 + investigacion$p29 +
investigacion$p36 + investigacion$p41 + investigacion$p48
investigacion$agresividad <- investigacion$p2 + investigacion$p3 + investigacion$p7 +
investigacion$p11 + investigacion$p19 + investigacion$p32 + investigacion$p35 +
investigacion$p37 + investigacion$p44 + investigacion$p50
investigacion$sociabilidad <- investigacion$p4 + investigacion$p8 + investigacion$p15 +
investigacion$p20 + investigacion$p23 + investigacion$p28 + investigacion$p33 +
investigacion$p38 + investigacion$p45 + investigacion$p47
investigacion$impulsividad <- investigacion$p6 + investigacion$p13 + investigacion$p17 +
investigacion$p24 + investigacion$p26 + investigacion$p30 + investigacion$p34 +
investigacion$p39 + investigacion$p42 + investigacion$p49
investigacion$neuroticismo <- investigacion$p9 + investigacion$p10 + investigacion$p14 +
investigacion$p18 + investigacion$p22 + investigacion$p27 + investigacion$p31 +
investigacion$p40 + investigacion$p43 + investigacion$p46
investigacion$achivement <- (investigacion$vg9 + investigacion$vg10 + investigacion$vg11 +
investigacion$vg12)/4
investigacion$sociability <- (investigacion$vg1 + investigacion$vg2 + investigacion$vg3 +
investigacion$vg4)/4
investigacion$immersion <- (investigacion$vg5 + investigacion$vg6 + investigacion$vg7 +
investigacion$vg8)/4
describeBy(investigacion[1], group = investigacion$sexo, mat = FALSE, type = 3)
## group: 0
## vars n mean sd median trimmed mad min max range skew kurtosis
## edad 1 36 22.53 6.67 22 21.7 3.71 16 56 40 3.41 14.79
## se
## edad 1.11
## --------------------------------------------------------
## group: 1
## vars n mean sd median trimmed mad min max range skew kurtosis
## edad 1 13 22.77 9.71 21 20.73 2.97 15 53 38 2.24 4.31
## se
## edad 2.69
describeBy(investigacion[3], group = investigacion$sexo, mat = FALSE, type = 3)
## group: 0
## vars n mean sd median trimmed mad min max range skew kurtosis
## horas 1 36 20.81 23.21 10 18 13.34 0 78 78 1.07 -0.26
## se
## horas 3.87
## --------------------------------------------------------
## group: 1
## vars n mean sd median trimmed mad min max range skew kurtosis
## horas 1 13 14.15 19.15 5 11.27 7.41 0 60 60 1.27 0.18
## se
## horas 5.31
counts <- table(investigacion$sexo, investigacion$estiloJuego)
barplot(counts, main = "Distribución de Estilo de Juego por sexo", xlab = "Estilo de Juego",
names = c("Social", "Presencia", "Logro", "Sin preferencia"), col = c("darkgray",
"lightgray"), legend = c("Hombre", "Mujer"), beside = TRUE)
boxplot(investigacion$agresividad ~ investigacion$estiloJuego, data = investigacion,
main = "Agresividad por estilo de Juego", xlab = "Estilo de Juego", names = c("Social",
"Presencia", "Logro", "Sin preferencia"), ylab = "Agresividad")
boxplot(investigacion$sociabilidad ~ investigacion$estiloJuego, data = investigacion,
main = "Sociabilidad por estilo de Juego", xlab = "Estilo de Juego", names = c("Social",
"Presencia", "Logro", "Sin preferencia"), ylab = "Sociabilidad")
boxplot(investigacion$impulsividad ~ investigacion$estiloJuego, data = investigacion,
main = "Impulsividad por estilo de Juego", xlab = "Estilo de Juego", names = c("Social",
"Presencia", "Logro", "Sin preferencia"), ylab = "Impulsividad")
boxplot(investigacion$actividad ~ investigacion$estiloJuego, data = investigacion,
main = "Actividad por estilo de Juego", xlab = "Estilo de Juego", names = c("Social",
"Presencia", "Logro", "Sin preferencia"), ylab = "Actividad")
boxplot(investigacion$neuroticismo ~ investigacion$estiloJuego, data = investigacion,
main = "Neuroticismo por estilo de Juego", xlab = "Estilo de Juego", names = c("Social",
"Presencia", "Logro", "Sin preferencia"), ylab = "Neuroticismo")