From 6b3df60e4c68033be955402e0bf17b065c9320a0 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Tue, 1 Jan 2019 11:18:07 +0100 Subject: [PATCH] =?UTF-8?q?Katheterzahl=20pro=20Operateur=20im=20lfd.=20Ja?= =?UTF-8?q?hr=20eingef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vhk.Rmd | 54 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/vhk.Rmd b/vhk.Rmd index e56296b..9ee6f3b 100644 --- a/vhk.Rmd +++ b/vhk.Rmd @@ -11,15 +11,18 @@ output: ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE, warning = FALSE) library(tidyverse) +library(lubridate) raw_data = read_csv('vhk.csv') %>% - mutate(Year = lubridate::year(Date)) + mutate(Year = 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 +reference_year = year(today()) - (today() < make_date(year(today()), 1, 31)) + ``` ## Katheterimplantationen pro Jahr @@ -32,10 +35,24 @@ cath_by_year %>% labs(x = NULL, y = "Anzahl Katheter") ``` +## Katheterimplantationen pro Operateur im Jahr `r reference_year` +```{r} +raw_data %>% mutate(Year = year(Date)) %>% filter(Year == reference_year) %>% + count(Surgeon) %>% + arrange(n) %>% + mutate(Surgeon = factor(Surgeon, levels = Surgeon)) %>% + ggplot(aes(x = Surgeon, y = n)) + + geom_col() + + coord_flip() + + labs(x = NULL, y = stringr::str_c("Anzahl Katheter im Jahr ", reference_year)) +``` + + + + ## Alter der Patienten ```{r patient_age} @@ -190,8 +222,11 @@ raw_data %>% Nur Operateure der letzten 4 Jahre ```{r individual_fluoroscopy, message=FALSE} -raw_data %>% filter(Year > lubridate::year(lubridate::today()) - 4, !is.na(InsertionFluoroscopyDuration)) %>% +to_year = year(today()) %% 100 +from_year = to_year - 3 +raw_data %>% mutate(Year = Year %% 100) %>% + filter(Year >= from_year, !is.na(InsertionFluoroscopyDuration)) %>% group_by(Surgeon, Year) %>% summarize(FluoroscopyIndex = median(InsertionFluoroscopyDuration, na.rm = TRUE)) %>% ungroup() %>% @@ -199,6 +234,7 @@ raw_data %>% filter(Year > lubridate::year(lubridate::today()) - 4, !is.na(Inser ggplot(aes(x = Year, y = FluoroscopyIndex)) + geom_point() + geom_line() + + scale_x_continuous(breaks = seq(from = from_year, to = to_year, by = 1 )) + facet_wrap(vars(Surgeon)) + labs(x = NULL, y = "Median der Durchleuchtungsdauer [s]") ```