Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow variable x/y variables in bi_class #48

Open
kmcd39 opened this issue Oct 23, 2024 · 0 comments
Open

Allow variable x/y variables in bi_class #48

kmcd39 opened this issue Oct 23, 2024 · 0 comments

Comments

@kmcd39
Copy link

kmcd39 commented Oct 23, 2024

Hi!

It'd be awesome to be able to allow variable names in the bi_class function, to use this in more programmatic or interactive contexts in which the variables are not known in advance.

Regex:

# a working example w/ column names passed on directly
bicars <-
  tibble(cars) %>%
  biscale::bi_class(
     x = speed
    ,y = dist
    ,style = "equal"
  )

bicars # that works

# an example that doesn't work, where variables represent the same column names
first.column <- "speed"
second.column <- "dist"

tibble(cars) %>%
  biscale::bi_class(
    x = first.column
    ,y = second.column
    ,style = "equal"
  )

The second example doesn't work with !!, rlang::sym, or !!rlang::sym wrapping the variable column names either. It seems the as.character(substitute(.x)) freezes the evaluation? If there is a way to do this, including in the documentation would be helpful.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant