Skip to content

Support for categorical variables in type_summary() #436

Closed as not planned
Closed as not planned

Description

@marcboschmatas

I think it would be interesting to allow for the support of categorical variables in the x axis for summary plots, similar to ggplot, so that you could have something like

plt(bill_length_mm ~ species, data = penguins, type = type_summary(mean_se))

And get this in return

Image

I'd be happy to give it a go, if you think it would be useful!
Thanks in advance,

Activity

  1. grantmcdermott commented on Jul 12, 2025

    @grantmcdermott
    Owner

    Thanks for the suggestion. The tricky thing is that you'd need to amend type_summary so that it does two new things: (a) understands array returns with y, ymin, and ymax, and (b) can dynamically switch drawing types instead of just reverting to type_lines().

    (a) would require a major refactor since we couldn't just rely on ave() anymore for the internal conversion. (b) would be complicated on its own, although potentially doable via a draw_type argument or similar.

    Given this, my guess is that it would be easier just to call plt(..., data = mean_se(bill_length_mm ~ species, penguins), type = "pointrange").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions