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

Plot method for data_tabulate()? #289

Closed
etiennebacher opened this issue May 22, 2023 · 2 comments · Fixed by #293
Closed

Plot method for data_tabulate()? #289

etiennebacher opened this issue May 22, 2023 · 2 comments · Fixed by #293
Labels
Enhancement 💥 New feature or request

Comments

@etiennebacher
Copy link
Member

Asked in easystats/datawizard#419

It would be nice to have a plot method to do this:

library(ggplot2)
library(datawizard)

# Data Tabulate

## Desired input
dt <- data_tabulate(mpg, select = c("cyl", "drv"))
### Option 1: plot(dt)
### Option 2: data_tabulate(mpg, select = c("cyl", "drv"), plot = TRUE)

## Desired output
mpg |> 
  data_select(select = c("cyl", "drv")) |> 
  data_to_long() |> 
  ggplot(aes(x = value)) +
  facet_wrap(~name, scales = "free") +
  geom_bar()

Created on 2023-05-22 with reprex v2.0.2

@etiennebacher etiennebacher transferred this issue from easystats/datawizard May 22, 2023
@strengejacke strengejacke added the Enhancement 💥 New feature or request label May 23, 2023
@etiennebacher
Copy link
Member Author

@strengejacke I feel like this is very close to sjlabelled::plot_frq(), maybe there's a way to simply reuse this code?

@strengejacke
Copy link
Member

I wrote sjPlot years ago, I don't think we want to use that code 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement 💥 New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants