Skip to content

prevent (or add option to prevent) stratum/lode positions from depending on missing value inclusion/exclusion #148

@corybrunson

Description

@corybrunson

Currently, setting na.rm = FALSE affects the vertical placement of strata. Ideally, it would not, so that, for example, the stratum layer could omit entries with missing values and the alluvium layer retain them. See the example below, which illustrates the incompatibility.

# date-valued axis variables
vaccinations |> 
  transform(response = dplyr::if_else(response == "Missing", NA, response)) |> 
ggplot(aes(x = end_date, y = freq, stratum = response, alluvium = subject,
           fill = response)) +
  stat_alluvium(geom = "flow", lode.guidance = "forward",
                width = 60, na.rm = FALSE) +
  stat_stratum(width = 60, na.rm = TRUE) +
  labs(x = "Survey date", y = "Number of respondents")
#> Error in ggplot(transform(vaccinations, response = dplyr::if_else(response == : could not find function "ggplot"

Created on 2025-08-16 with reprex v2.1.1

Note: This behavior arose while experimenting with this SO question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions