print_and_pass | R Documentation |
This function can be placed within a sequence of %>%
pipes for debugging purposes.
It will literally print the output of the function you specify on whatever was passed into it, and then pass it out, untouched. If you want to just print a string with no bearing on whatever is being piped, then set the .text
variable to that string.
print_and_pass(.x, .f = identity, .text = NULL, ...)
.x |
Whatever is being piped down the pipeline |
.f |
A function, formula, or atomic vector, which will be applied to |
.text |
When explicitly set to a non- |
... |
Additional named arguments for whatever function is being passed in. |
The value of .x
df <- data.frame(x=runif(10)) new_df <- df %>% print_and_pass(.text="BEGIN DEBUG") %>% dplyr::mutate(y=x+4) %>% print_and_pass(~.$y) %>% dplyr::filter(y>4) %>% print_and_pass(.text="END DEBUG")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.