#Example 1 (change text):
clinic_patient |>
as_fc(label = "Patients included") |>
fc_filter(age >= 18 & consent == "Yes", label = "Patients included", show_exc = TRUE) |>
fc_modify(~.x |>
dplyr::mutate(
text = dplyr::case_when(
id == 3 ~ stringr::str_glue("Excluded patients:
- {sum(clinic_patient$age < 18)} under-age
- {sum(clinic_patient$consent == 'No')} no consent
"),
TRUE ~ text
)
)) |>
fc_draw()
#Example 2 (change coordinates):
clinic_patient |>
as_fc(label = "Patients included") |>
fc_filter(age >= 18 & consent == "Yes", label = "Patients included", show_exc = TRUE) |>
fc_modify(~.x |>
dplyr::mutate(
x = dplyr::case_when(
id == 3 ~ 0.8,
TRUE ~ x
),
y = dplyr::case_when(
id == 1 ~ 0.85,
id == 2 ~ 0.15,
id == 3 ~ 0.5
)
)) |>
fc_draw()
Run the code above in your browser using DataLab