From 2fbfa7aa6ea6c3cc9c82aec89b271ece247fa400 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Fri, 28 Dec 2018 14:10:19 +0100 Subject: [PATCH] Initial commit. --- .gitignore | 7 ++++++ VHK.Rproj | 16 ++++++++++++ vhk.Rmd | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 .gitignore create mode 100644 VHK.Rproj create mode 100644 vhk.Rmd diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c72fdde --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.Rproj.user +.Rhistory +.RData +.Ruserdata +*.pdf +*.html +*-figure/ diff --git a/VHK.Rproj b/VHK.Rproj new file mode 100644 index 0000000..e83436a --- /dev/null +++ b/VHK.Rproj @@ -0,0 +1,16 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes diff --git a/vhk.Rmd b/vhk.Rmd new file mode 100644 index 0000000..20917d0 --- /dev/null +++ b/vhk.Rmd @@ -0,0 +1,72 @@ +--- +title: "Vorhofkatheter-Statistik" +author: "Daniel Kraus" +date: '2018-12-30' +output: + ioslides_presentation: default + beamer_presentation: default +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = FALSE) +library(tidyverse) + +raw_data = read_csv('vhk.csv') %>% + mutate(Year = lubridate::year(Date)) + +cath_by_year = raw_data %>% count(Year) +first_year = min(raw_data$Year) +last_year = max(raw_data$Year) +max_y_break = ((max(cath_by_year$n) %/% 10) + 1) * 10 + +``` + +## Katheterimplantationen pro Jahr +```{r cath_by_year } +cath_by_year %>% + ggplot(aes(x = Year, y = n)) + + geom_col() + + scale_y_continuous(breaks = seq(from = 0, to = max_y_break, by = 10)) + + scale_x_continuous(breaks = seq(from = first_year, to = last_year, by = 1)) + + labs(x = NULL, y = NULL) +``` + +## Alter der Patienten +```{r patient_age} +raw_data %>% + ggplot(aes(group = Year, x = Year, y = Age)) + + geom_boxplot() + + coord_cartesian(ylim = c(20, 100)) + + scale_x_continuous(breaks = seq(from = first_year, to = last_year, by = 1)) + + scale_y_continuous(breaks = seq(from = 20, to = 100, by = 10)) + + labs(x = NULL, y = NULL) +``` + +## Geschlecht der Patienten +```{r patient_sex} +raw_data %>% group_by(Year) %>% summarise(PercentFemale = sum(Sex == "weiblich") / n()) %>% + ggplot(aes(x = Year, y = PercentFemale)) + + geom_col() + + scale_x_continuous(breaks = seq(from = first_year, to = last_year, by = 1)) + + scale_y_continuous(labels = scales::percent_format(accuracy = 1)) + + labs(x = NULL, y = "Anteil Frauen") +``` + +## Hitparade der Implanteure +```{r greatest_surgeons} +raw_data %>% count(Surgeon) %>% arrange(n) %>% top_n(10, n) %>% mutate(Surgeon = factor(Surgeon, levels = Surgeon)) %>% + ggplot(aes(x = Surgeon, y = n)) + + geom_col() + + coord_flip() + + labs(x = NULL, y = NULL) +``` + +## Hitparade der Assistenten +```{r greatest_assistants} +raw_data %>% count(Assistant) %>% arrange(n) %>% top_n(10, n) %>% mutate(Assistant = factor(Assistant, levels = Assistant)) %>% + ggplot(aes(x = Assistant, y = n)) + + geom_col() + + coord_flip() + + labs(x = NULL, y = NULL) +``` +