print_pipe | R Documentation |
Sometimes when I am working on a series of piped code, I want to see the
interim results when I am adding lines etc. It used to be that you could add
%>% {.}
with the pipe command from magrittr
package (you still can), but
this does not work with the native pipe |>
. This is my workaround.
print_pipe(x, n = NULL)
x |
An object or value from a previous pipe to print. |
n |
Number of rows to print. |
A wrapper around x %>% print()
or x |> print()
library(dplyr)
library(palmerpenguins)
penguins |>
group_by(species) |>
summarise(mean_bill_length_mm = mean(bill_length_mm, na.rm = TRUE)) |>
print_pipe()
penguins |>
print_pipe()
penguins |>
print_pipe(n = Inf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.