print_pipe_steps {ViewPipeSteps} | R Documentation |
Prints the return objects of all pipe steps to console
Description
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().
Usage
print_pipe_steps(.data, cmd = print_command, all = FALSE)
Arguments
.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. |
Value
The unchanged data
Examples
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)
)
[Package ViewPipeSteps version 0.1.0 Index]