Skip to content

Split data at the top #172

@vincentarelbundock

Description

@vincentarelbundock

Follow-up to this comment about introducing a by argument to type_*() functions: #168 (comment)

Is there a reason to wait so long before splitting the data? It seems that in some cases we wait until nearly the end to create split_data, and in many other cases like hist or density, we need to insert special catches near the top of the function. I feel like that introduces a lot of complexity.

Have you considered splitting the data at the very top, and storing it in a nested list?

split_data = list(
  facet_01 = list(by_01 = list(x, y), by_02 = list(x, y)),
  facet_02 = list(by_01 = list(x, y), by_02 = list(x, y))
)

Then, all plotting functions can operate on individual elements in exactly the same way. And if the list is of length 1, we know there are no facets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions