Skip to content

Commit

Permalink
Merge pull request #53 from EvaMaeRey/patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
rsh52 authored Aug 12, 2024
2 parents 3dab517 + f0233f0 commit 8ea54fe
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
10 changes: 4 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ To help you get started, ggswim includes three sample datasets: `patient_data`,

ggswim offers several geom-functions, and by using `geom_swim_lane()` we can set up the horizontal response paths of our swimmer plot, i.e. the "lanes". We'll also set up corresponding arrows to indicate subjects that are still on the trial:

```{r, include=FALSE}
```{r, message=FALSE}
library(ggswim)
library(ggplot2)
# Construct arrow_data for arrow display later
arrow_data <- patient_data |>
dplyr::left_join(
end_study_events |>
Expand All @@ -53,11 +56,6 @@ arrow_data <- patient_data |>
dplyr::select(pt_id, end_time, end_study_name) |>
dplyr::filter(.by = pt_id, end_time == max(end_time)) |>
unique()
```

```{r, message=FALSE}
library(ggswim)
library(ggplot2)
p <- patient_data |>
ggplot() +
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ that are still on the trial:
library(ggswim)
library(ggplot2)

# Construct arrow_data for arrow display later
arrow_data <- patient_data |>
dplyr::left_join(
end_study_events |>
dplyr::select(pt_id, end_study_name),
by = "pt_id"
) |>
dplyr::select(pt_id, end_time, end_study_name) |>
dplyr::filter(.by = pt_id, end_time == max(end_time)) |>
unique()

p <- patient_data |>
ggplot() +
geom_swim_lane(
Expand All @@ -66,7 +77,7 @@ p <- patient_data |>
p
```

<img src="man/figures/README-unnamed-chunk-3-1.png" width="100%" />
<img src="man/figures/README-unnamed-chunk-2-1.png" width="100%" />

Next we’ll add on events of interest: end of study updates and
infusions. We’ll refer to these as “markers” and call them with two more
Expand All @@ -89,7 +100,7 @@ p <- p +
p
```

<img src="man/figures/README-unnamed-chunk-4-1.png" width="100%" />
<img src="man/figures/README-unnamed-chunk-3-1.png" width="100%" />

Finally, we’ll beautify the plot with familiar ggplot2 techniques and a
last finishing touch with `theme_ggswim()`:
Expand All @@ -102,7 +113,7 @@ p +
theme_ggswim()
```

<img src="man/figures/README-unnamed-chunk-5-1.png" width="100%" />
<img src="man/figures/README-unnamed-chunk-4-1.png" width="100%" />

## Collaboration

Expand Down
Binary file modified man/figures/README-unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8ea54fe

Please sign in to comment.