Tidy-printing of the code attached to an object
Examples
iris_agg <- aggregate_data(iris, group_vars = "Species", summaries = "mean")
print_code(iris_agg)
#> iris |>
#> dplyr::group_by(Species) |>
#> dplyr::summarise(
#> Sepal.Length_mean = mean(Sepal.Length,
#> na.rm = TRUE
#> ),
#> Sepal.Width_mean = mean(Sepal.Width,
#> na.rm = TRUE
#> ),
#> Petal.Length_mean = mean(Petal.Length,
#> na.rm = TRUE
#> ),
#> Petal.Width_mean = mean(Petal.Width,
#> na.rm = TRUE
#> ),
#> .groups = "drop"
#> )
#>