Description Usage Arguments Value Examples
View source: R/print_pipe_steps.R
Added as last command to a pipe, prints for each pipe step the resulting object to the console if unique. Data frames are converted by as_tibble().
1 | print_pipe_steps(.data, cmd = print_command, all = FALSE)
|
.data |
The data, normally handed over from the prior pipe step. |
cmd |
The command to be evaluated for each object. Takes ps object of step example. |
all |
Whether you want to print objects even if they are identical. Helpful when you want to display changes in grouping. |
The unchanged data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | if (!require(dplyr)) stop("Examples need dplyr to run")
mtcars %>%
filter(am == 1) %>%
select(qsec) %>%
print_pipe_steps() -> result
my_print_cmd <- c(
"message(title);",
"skimr::skim_tee(data = ps%d)"
)
mtcars %>%
select(am, hp, mpg) %>%
group_by(am) %>%
print_pipe_steps(my_print_cmd, all = TRUE) %>%
summarize(
nobs = n(),
mean_hp = mean(hp),
mean_mpg = mean(mpg)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.