summarizing.Rmd
The datamations API can visualize the summarization of variables with several dplyr verbs, like summarize()
/summarise()
, count()
, and tally()
datamations_sanddance
has special animations to visualize certain common summary functions passed to summarize
. These custom animations include:
mean
median
max
/min
quantile
"small_salary %>%
group_by(Work) %>%
summarise(mean_salary = mean(Salary))" %>%
datamation_sanddance()
#> Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
#> dplyr 1.1.0.
#> ℹ Please use `reframe()` instead.
#> ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
#> always returns an ungrouped data frame and adjust accordingly.
#> ℹ The deprecated feature was likely used in the datamations package.
#> Please report the issue to the authors.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
"small_salary %>%
group_by(Work) %>%
summarise(median_salary = median(Salary))" %>%
datamation_sanddance()
"small_salary %>%
group_by(Work) %>%
summarise(min_salary = min(Salary))" %>%
datamation_sanddance()
"small_salary %>%
group_by(Work) %>%
summarise(max_salary = max(Salary))" %>%
datamation_sanddance()
The summarize function includes the capacity to pass some parameterized functions that result in custom animations. Currently datamations supports the quantile()
function with the probs
parameter as an example of this capability.
"small_salary %>%
group_by(Degree) %>%
summarise(quan = quantile(Salary, probs = 0.01))" %>%
datamation_sanddance()
Common summary functions may include count-like operations, like n_distinct.
library(palmerpenguins)
"penguins %>%
group_by(island) %>%
summarise(n = n_distinct(species))" %>%
datamation_sanddance()
You can find the API can support a large variety of mathematical functions and dplyr functions
"small_salary %>%
group_by(Degree) %>%
summarize(floor_salary = trunc(Salary))" %>%
datamation_sanddance()
#> Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
#> dplyr 1.1.0.
#> ℹ Please use `reframe()` instead.
#> ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
#> always returns an ungrouped data frame and adjust accordingly.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
"small_salary %>%
group_by(Degree) %>%
summarize(first_salary = first(Salary))" %>%
datamation_sanddance()
"small_salary %>%
group_by(Degree) %>%
summarize(lagged_salary = lag(Salary))" %>%
datamation_sanddance()
#> Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
#> dplyr 1.1.0.
#> ℹ Please use `reframe()` instead.
#> ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
#> always returns an ungrouped data frame and adjust accordingly.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
datamations treats count()
and tally()
calls equivalently to group_by()
+ summarize(n = n())
.
"small_salary %>%
group_by(Degree) %>%
count(Salary)" %>%
datamation_sanddance()