tidyverse / tidyverse/ggplot2

Provide some tidyselect like interface for facetting

Open
#4,999 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API change 😈 facets :gem: feature
Dominant language
R
Stars
7k
Forks
2.1k
Avg merge
59m
Merged PRs (30d)
2

Description

So you could do (e.g.)

diamonds |>
  ggplot() |>
  geom_histogram(aes(carat)) |>
  facet_wrap(vars_select(starts_with("c") & !carat))

(Motivating real function: https://twitter.com/avakiai/status/1574392928545513472)

I don't think this is that useful in direct analysis but it makes certain programmatic usages possible that are otherwise very hard.

Alternatively if it was possible to make facet_wrap(vars(data.frame(vs, cyl)) work, then we could attack the problem via across()/pick() which has the advantage of working the same way as in dplyr.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the facet_wrap() and vars() interfaces shown in the issue, along with the proposed vars_select(), across(), and pick() approaches. Compare the programmatic facetting use case with the existing behavior and determine which interface should be supported; done means a documented, tested way to select facet variables programmatically.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.