diff --git a/README.Rmd b/README.Rmd index f42c007..22a2caa 100644 --- a/README.Rmd +++ b/README.Rmd @@ -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 |> @@ -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() + diff --git a/README.md b/README.md index 9220866..d1c1b04 100644 --- a/README.md +++ b/README.md @@ -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( @@ -66,7 +77,7 @@ p <- patient_data |> p ``` - + 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 @@ -89,7 +100,7 @@ p <- p + p ``` - + Finally, we’ll beautify the plot with familiar ggplot2 techniques and a last finishing touch with `theme_ggswim()`: @@ -102,7 +113,7 @@ p + theme_ggswim() ``` - + ## Collaboration diff --git a/man/figures/README-unnamed-chunk-2-1.png b/man/figures/README-unnamed-chunk-2-1.png index 1c7f4e0..105065e 100644 Binary files a/man/figures/README-unnamed-chunk-2-1.png and b/man/figures/README-unnamed-chunk-2-1.png differ diff --git a/man/figures/README-unnamed-chunk-3-1.png b/man/figures/README-unnamed-chunk-3-1.png index 105065e..a6a4a50 100644 Binary files a/man/figures/README-unnamed-chunk-3-1.png and b/man/figures/README-unnamed-chunk-3-1.png differ diff --git a/man/figures/README-unnamed-chunk-4-1.png b/man/figures/README-unnamed-chunk-4-1.png index a6a4a50..590822f 100644 Binary files a/man/figures/README-unnamed-chunk-4-1.png and b/man/figures/README-unnamed-chunk-4-1.png differ