skrypt
This commit is contained in:
parent
37cc132e32
commit
ddec9adfa4
@ -11,6 +11,19 @@ con <- DBI::dbConnect(
|
|||||||
countries <- tbl(con, "dim_countries")
|
countries <- tbl(con, "dim_countries")
|
||||||
drugs <- tbl(con, "dim_drugs")
|
drugs <- tbl(con, "dim_drugs")
|
||||||
time <- tbl(con, "dim_time")
|
time <- tbl(con, "dim_time")
|
||||||
|
status <- tbl(con, "dim_claim_statuses")
|
||||||
|
|
||||||
|
tbl(con, "FT_Refund") %>%
|
||||||
|
inner_join(time, by = c("response_time_fk" = "time_sk")) %>%
|
||||||
|
inner_join(status, by = c("claim_status_fk" = "claim_status_sk")) %>%
|
||||||
|
filter(year >= 2008 && year <= 2016) %>%
|
||||||
|
group_by(year, status_description) %>%
|
||||||
|
summarize(how_many = sum(cnt)) %>%
|
||||||
|
ungroup() %>%
|
||||||
|
ggplot(aes(year, how_many, fill = status_description)) +
|
||||||
|
geom_bar(stat = "identity") +
|
||||||
|
scale_x_continuous(breaks = 2009:2016) +
|
||||||
|
facet_grid(. ~ status_description)
|
||||||
|
|
||||||
tbl(con, "FT_Refund") %>%
|
tbl(con, "FT_Refund") %>%
|
||||||
inner_join(countries, by = c("country_fk" = "country_sk")) %>%
|
inner_join(countries, by = c("country_fk" = "country_sk")) %>%
|
||||||
@ -20,11 +33,26 @@ tbl(con, "FT_Refund") %>%
|
|||||||
geom_point() +
|
geom_point() +
|
||||||
xlab("Cena") +
|
xlab("Cena") +
|
||||||
ylab("% zniki")
|
ylab("% zniki")
|
||||||
|
|
||||||
|
|
||||||
tbl(con, "FT_Refund") %>%
|
tbl(con, "FT_Refund") %>%
|
||||||
inner_join(time, by = c("response_time_fk" = "time_sk")) %>%
|
inner_join(time, by = c("response_time_fk" = "time_sk")) %>%
|
||||||
filter(year == 2009) %>%
|
inner_join(drugs, by = c("drug_fk" = "drug_sk")) %>%
|
||||||
head(n = 500) %>%
|
filter(year %in% c(2009, 2010)) %>%
|
||||||
select(year, month, day, price)
|
mutate(sale = ifelse(reimbursement_amountPercent > 30, "on sale", "not on sale")) %>%
|
||||||
|
ggplot(aes(month, price, fill = drug_product_family_name)) +
|
||||||
|
geom_bar(stat = "identity") +
|
||||||
|
scale_x_continuous("month", breaks = 1:12) +
|
||||||
|
facet_grid(sale ~ year)
|
||||||
|
|
||||||
|
tbl(con, "FT_Registration") %>%
|
||||||
|
inner_join(time, by = c("response_time_fk" = "time_sk")) %>%
|
||||||
|
group_by(year) %>%
|
||||||
|
summarize(how_many = sum(cnt)) %>%
|
||||||
|
filter(how_many > 0) %>%
|
||||||
|
mutate(decade = floor(year / 10) * 10) %>%
|
||||||
|
ggplot(aes(year, how_many)) +
|
||||||
|
geom_area()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user