forked from fmauffrey/EpiPlot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport_word.Rmd
91 lines (74 loc) · 2.75 KB
/
report_word.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
output: "word_document"
params:
set_title: NA
set_date: NA
set_author1: NA
set_author2: NA
typing_method: NA
table: NA
move_plot: NA
network_plot: NA
epiplot_version: NA
comments: NA
date_min: NA
date_max: NA
genotype: NA
species: NA
workdir: NA
title: "`r params$set_title`"
date: "`r params$set_date`"
author: "`r params$set_author1` - `r params$set_author2`"
header-includes:
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyhead[R]{EpiPlot `r params$epiplot_version`}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(message = FALSE, warning = FALSE)
options(knitr.kable.NA = '')
```
```{r echo=F, out.width="200px"}
knitr::include_graphics(paste0(params$workdir, "/www/Epiplot_logo.png"))
```
Ce rapport a été généré avec les données suivantes:
- Nombre de patients: `r nrow(params$table)`
- Période: `r params$date_min` au `r params$date_max`
- Organisme: `r params$species`
- Méthode de typage: `r params$typing_method`
- Génotype: `r params$genotype`
# Commentaires
`r params$comments`
\newpage
# Table des données
```{r echo=F}
sum_table <- params$table
colnames(sum_table) <- gsub("_", " ", colnames(sum_table))
knitr::kable(sum_table,
align = "c",
digits = 1,
caption = "Résumé des séjours de chaque patient à l'hôpital.")
```
\newpage
# Mouvements des patients à l'hôpital
```{r echo=F, out.width = "100%", fig.cap="Mouvements des patients à l'hôpital. Les mouvements sont représentés par des barres indiquant la durée de séjour de chaque patient dans une unité. Les différentes unités sont distinguées par un code couleur. Pour chaque patient, les prélèvements positifs et négatifs sont marqués respectivement par un losange rouge et un rond vert."}
temp_file <- tempfile(fileext = ".png")
# Save the plot as an image to the temporary file (necessary for writing on server)
save_image(params$move_plot, temp_file,
width = "1024",
height = "512")
# Copy the temporary file to the final destination
knitr::include_graphics(temp_file)
```
\newpage
# Analyse en réseau des mouvements
```{r echo=F, out.width = "100%", fig.cap="Réseau montrant les périodes communes d'hospitalisation dans les mêmes unités de soins. Chaque patient est représenté par un cercle, et les liens entre les cercles indiquent le nombre de jours passés par ces patients dans la même unité au même moment."}
temp_file1 <- tempfile(fileext = ".html")
temp_file2 <- tempfile(fileext = ".png")
# Save the plot without printing it
network_plot <- params$network_plot %>%
visSave(temp_file1)
# Conversion of html to image. Put in a variable to avoid printing
webshot <- webshot(temp_file1, zoom = 1, file = temp_file2)
knitr::include_graphics(temp_file2)
```