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

datasummary_balance weights in percentages #500

Open
vincentarelbundock opened this issue Jun 13, 2022 · 0 comments
Open

datasummary_balance weights in percentages #500

vincentarelbundock opened this issue Jun 13, 2022 · 0 comments
Labels
good first issue Good for newcomers

Comments

@vincentarelbundock
Copy link
Owner

Conditional on weights being a column, do something like this:

wtpct <- function(x, y) sum(x, na.rm = TRUE) / sum(y, na.rm = TRUE) * 100
datasummary(species * sex + 1 ~ N + flipper_length_mm * Percent(fn = wtpct),
            output = "markdown",
            data = penguins)
@vincentarelbundock vincentarelbundock added the enhancement New feature or request label Jun 13, 2022
@vincentarelbundock vincentarelbundock removed the enhancement New feature or request label Jul 24, 2022
@vincentarelbundock vincentarelbundock added the good first issue Good for newcomers label Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant