-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexample_report.Rmd
More file actions
62 lines (54 loc) · 1.4 KB
/
example_report.Rmd
File metadata and controls
62 lines (54 loc) · 1.4 KB
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
60
61
62
---
title: "ISARIC-4C data example report"
date: "`r Sys.time()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(lubridate)
library(finalfit)
library(kableExtra)
# Save image to spare the API:
# source("00_source_all.R")
# save.image(file = "00_source_all.RData")
load("00_source_all.RData")
```
## Admissions plot
```{r admissions_plot, message=FALSE, warning=FALSE}
topline %>%
filter(sex != "Not specified") %>%
filter(hostdat < Sys.Date()) %>%
arrange(hostdat) %>%
group_by(sex) %>%
mutate(
cum = seq_along(hostdat)
) %>%
drop_na(sex) %>%
ggplot_lancet(aes(x = hostdat, y = cum, colour = sex)) +
geom_line() +
scale_colour_brewer(palette = "Set1") +
labs(x = "Admission date", y = "Number of patients") +
theme(legend.position = c(0.05, 1),
legend.justification = c(0, 1)) +
# facet_wrap(.~sex) +
coord_cartesian(xlim = c(ymd(20200201,NA))) +
ggtitle("Hospital admission with COVID-19 by sex",
"Figure 1A")
```
## Demographics table
```{r dem_table, warning=FALSE}
topline %>%
mutate_if(is.factor, fct_explicit_na) %>%
summary_factorlist(
explanatory = c(
"age", "sex",
"healthwork_erterm", "labwork_erterm",
"onset2admission",
"hooccur",
"travel_erterm"),
na_include = TRUE,
add_col_totals = TRUE
) %>%
mytable(longtable = FALSE)
```