-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheurostat.Rmd
60 lines (37 loc) · 1.22 KB
/
eurostat.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
---
title: "Eurostat R package"
output: html_notebook
editor_options:
chunk_output_type: inline
---
# Introduction
Eurostat data and `trelliscopej` package to explore the Eurostat dataset
```{r "setup"}
knitr::opts_chunk$set(cache = TRUE, echo = TRUE)
library(eurostat)
library(dplyr)
library(ggplot2)
library(tidyr)
library(rvest)
library(httr)
library(trelliscopejs)
options(scipen = 3)
```
```{r "view available health data"}
toc <- get_eurostat_toc()
toc %>% filter(grepl("hlth", code) & type == "dataset")
```
```{r "hospitalisation rate"}
## Extract data
data <- get_eurostat("hlth_co_disch2t", type = "label", time_format = "num") ## this downloads > 6.6 million rows of data
Hmisc::describe(data)
## Data is inpatients admission rate, by age, by region, for 150 reasons for admission, from 2000 - 2014
```
To plot all the time series potentially means `r 150 * 184 * 23` charts, which we can create with `trelliscopejs` (although this will take several hours). To illustrate we'll look at admissions for acloholic liver disease (takes several minutes).
```{r "trellis charts"}
data %>%
filter(icd10 == "Alcoholic liver disease") %>%
ggplot(aes(time, values)) +
geom_line()
facet_trelliscope(~geo + age)
```