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

Add by to describe_distribution() #582

Open
DominiqueMakowski opened this issue Jan 11, 2025 · 2 comments
Open

Add by to describe_distribution() #582

DominiqueMakowski opened this issue Jan 11, 2025 · 2 comments

Comments

@DominiqueMakowski
Copy link
Member

datawizard::describe_distribution(iris, select="Sepal.Width", by="Species")

Would be very convenient

@etiennebacher
Copy link
Member

Isn't data_group() enough?

library(datawizard)

iris |> 
  data_group("Species") |> 
  describe_distribution(select="Sepal.Width")
#> # Species=setosa
#> 
#> Variable    | Mean |   SD |  IQR |        Range | Skewness | Kurtosis |  n | n_Missing
#> --------------------------------------------------------------------------------------
#> Sepal.Width | 3.43 | 0.38 | 0.52 | [2.30, 4.40] |     0.04 |     0.95 | 50 |         0
#> 
#> # Species=versicolor
#> 
#> Variable    | Mean |   SD |  IQR |        Range | Skewness | Kurtosis |  n | n_Missing
#> --------------------------------------------------------------------------------------
#> Sepal.Width | 2.77 | 0.31 | 0.50 | [2.00, 3.40] |    -0.36 |    -0.37 | 50 |         0
#> 
#> # Species=virginica
#> 
#> Variable    | Mean |   SD |  IQR |        Range | Skewness | Kurtosis |  n | n_Missing
#> --------------------------------------------------------------------------------------
#> Sepal.Width | 2.97 | 0.32 | 0.40 | [2.20, 3.80] |     0.37 |     0.71 | 50 |         0

@DominiqueMakowski
Copy link
Member Author

Fair, but we have by in a quite a lot of functions now and given the tidyverse's move towards an integrated .by I think it would make sense to support that. Also the output could be a simpler integrated dataframe with a Species column

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

2 participants