From d6c1eb612a6c61a634087bdc97909ae9f23fd276 Mon Sep 17 00:00:00 2001 From: Mariusz Sielski Date: Sun, 27 Jan 2019 14:04:28 +0100 Subject: [PATCH] ddd --- raportowanie.r | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/raportowanie.r b/raportowanie.r index 7a36e46..7c5a6a6 100644 --- a/raportowanie.r +++ b/raportowanie.r @@ -60,17 +60,25 @@ tbl(con, "FT_Refund") %>% facet_grid(sale ~ year) -tbl(con, "FT_Registration") %>% +registration_decades <- tbl(con, "FT_Registration") %>% inner_join(time, by = c("submission_date_fk" = "time_sk")) %>% inner_join(status, by = c("claim_status_fk" = "claim_status_sk")) %>% mutate(decade = floor(year / 10) * 10, got_answer = status_code_bk != "W") %>% + filter(decade < 2020, decade >= 1980) + + +with_grouping_by_answer <- registration_decades %>% + group_by(decade) %>% + summarize(how_many = sum(cnt)) + +registration_decades %>% group_by(decade, got_answer) %>% summarize(how_many = sum(cnt)) %>% - filter(how_many > 0, decade < 2020, decade >= 1980) %>% + filter(how_many > 0) %>% ggplot(aes(decade, how_many, fill = got_answer)) + geom_bar(stat = "identity") + - geom_label(aes(label=how_many)) + - geom_text(stat = "count", y = 5000, aes(label = ..count..)) + geom_label(aes(label = how_many)) + + geom_label(data = with_grouping_by_answer, aes(y = how_many, label = how_many, fill = NULL))