Skip to content

Preserve order of factors in gg_season() and gg_suberies() #165

@pasahe

Description

@pasahe

Hello,

Facets created when using gg_season() and gg_subseries() on a tsibble with a factor in its keys are not ordered on the levels of the factor. Here is some reproducible code based on the example documentation of gg_subseries()

tsibbledata::aus_retail |> 
  filter(
    Industry == "Cafes, restaurants and catering services"
  ) |> 
  mutate(
    State = forcats::fct_infreq(State)
  ) |>
  gg_subseries(Turnover)

I have reordered the State variable based on the frequency of its values, but the facets are still ordered alphabetically ignoring the order of the levels.

Thank you very much!

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