mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 05:26:13 +01:00
better example of grouping variable in ggplot_rsi
This commit is contained in:
parent
b0995362af
commit
1699d7b8b3
12
README.md
12
README.md
@ -145,15 +145,17 @@ septic_patients %>%
|
|||||||
|
|
||||||
![example_3_rsi](man/figures/rsi_example3.png)
|
![example_3_rsi](man/figures/rsi_example3.png)
|
||||||
|
|
||||||
It also supports grouping variables. Let's say we want to compare resistance of these antibiotics between hospitals A to D (variable `hospital_id`):
|
It also supports grouping variables. Let's say we want to compare resistance of drugs against Urine Tract Infections (UTI) between hospitals A to D (variable `hospital_id`):
|
||||||
|
|
||||||
```r
|
```r
|
||||||
septic_patients %>%
|
septic_patients %>%
|
||||||
select(hospital_id, amox, cipr) %>%
|
select(hospital_id, amox, nitr, fosf, trim, cipr) %>%
|
||||||
group_by(hospital_id) %>%
|
group_by(hospital_id) %>%
|
||||||
ggplot_rsi() + # start adding ggplot elements here with `+`
|
ggplot_rsi(x = "hospital_id",
|
||||||
facet_grid("hospital_id") + # splitting the plots on our grouping variable
|
facet = "Antibiotic",
|
||||||
labs(title = "AMR of Amoxicillin And Ciprofloxacine Per Hospital")
|
nrow = 1) +
|
||||||
|
labs(title = "AMR of Anti-UTI Drugs Per Hospital",
|
||||||
|
x = "Hospital")
|
||||||
```
|
```
|
||||||
|
|
||||||
![example_4_rsi](man/figures/rsi_example4.png)
|
![example_4_rsi](man/figures/rsi_example4.png)
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
Loading…
Reference in New Issue
Block a user