-
Notifications
You must be signed in to change notification settings - Fork 1
/
deskriptivni_analyza.Rmd
119 lines (98 loc) · 3.58 KB
/
deskriptivni_analyza.Rmd
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
title: "Deskriptivni analyza"
author: "Ondrej Plachy"
date: "August 26, 2016"
output: html_document
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
```{r libraries, echo=FALSE}
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(ggplot2))
suppressPackageStartupMessages(library(knitr))
suppressPackageStartupMessages(library(reshape))
suppressPackageStartupMessages(library(likert))
suppressPackageStartupMessages(library(plyr))
```
```{r, echo = FALSE}
svl2 <- read.csv("svl2.csv", header = T)
```
```{r, echo=FALSE}
getPercentString <- function(count, from) {
return(paste(round((100*count)/from, 2), "%", sep = ""))
}
factorize <- function(df, colNames) {
dl <- lapply(df, factor)
return(as.data.frame(dl))
}
```
``` {r, echo=FALSE}
factorize(svl2)
```
---
# ADMINISTRATIVNI CAST
---
``` {r, echo=FALSE}
Perc.summary2(svl2$B.2)
"delka rozhovoru"
summary(svl2$Delka.rozhovoru)
"pocty incidenci"
incidenc1 <- summary(svl2$Pocet.incidencnich.zaznamu)
incidenc2 <- getPercentString(summary(svl2$Pocet.incidencnich.zaznamu),
NROW(svl2$Pocet.incidencnich.zaznamu))
incidenc.compl <- data.frame(unclass(summary(svl2$Pocet.incidencnich.zaznamu)),
check.names = FALSE, stringsAsFactors = FALSE)
colnames(incidenc.compl) <- c("cetnost")
incidenc.compl$procent <- incidenc2
incidenc.compl
"Pocty incidenci podle kraje a pohlavi"
tapply(svl2$Pocet.incidencnich.zaznamu, svl2$Kraj, summary)
tapply(svl2$Pocet.incidencnich.zaznamu, svl2$B.2, summary)
```
---
# SCREENOVACI CAST
---
```{r, echo=FALSE}
"pohlavi"
sex1 <- summary(svl2$B.2)
sex2 <- getPercentString(summary(svl2$B.2), NROW(svl2$B.2))
sex.compl <- data.frame(unclass(summary(svl2$B.2)), check.names = FALSE, stringsAsFactors = FALSE)
colnames(sex.compl) <- c("cetnost")
sex.compl$procent <- sex2
sex.compl
"Kraje"
kraj1 <- summary(svl2$Kraj)
kraj2 <- getPercentString(summary(svl2$Kraj), NROW(svl2$Kraj))
kraj.compl <- data.frame(unclass(summary(svl2$Kraj)), check.names = FALSE, stringsAsFactors = FALSE)
colnames(kraj.compl) <- c("cetnost")
kraj.compl$procent <- kraj2
kraj.compl
"vekove kohorty"
cohort1 <- summary(svl2$B.5b)
cohort2 <- getPercentString(summary(svl2$B.5b), NROW(svl2$B.5b))
cohort.compl <- data.frame(unclass(summary(svl2$B.5b)), check.names = FALSE, stringsAsFactors = FALSE)
colnames(cohort.compl) <- c("cetnost")
cohort.compl$procent <- cohort2
cohort.compl
"vekove kohorty podle pohlavi a podle kraje"
tapply(svl2$B.5b, svl2$B.2, summary)
tapply(svl2$B.5b, svl2$Kraj, summary)
"Rodinny status (L.1)"
status1 <- summary(svl2$L.1)
status2 <- getPercentString(summary(svl2$L.1), NROW(svl2$L.1))
status.compl <- data.frame(unclass(summary(svl2$L.1)), check.names = FALSE, stringsAsFactors = FALSE)
colnames(status.compl) <- c("cetnost")
status.compl$procent <- status2
status.compl
```
```{r data-transforms, echo=FALSE}
source("ggplot-grafy.R", encoding = "UTF-8")
ggplot(svl2, aes(x=Pocet.incidencnich.zaznamu)) +
stat_count(width = 0.5) +
labs(x="cetnost", y = "Pocet dotazniku", title = "Zaznamy incidence") +
theme(legend.position="none")
ggplot(svl2, aes(x=Pocet.incidencnich.zaznamu, colour = COHORT, ncol = 1)) +
stat_count(width = 0.5) +
facet_wrap(~ COHORT) +
labs(x="cetnost", y = "Pocet dotazniku", title = "Pocet incidenci podle vekovych kohort") +
theme(legend.position="none")
```