I am writing a function with several pipes. I would like to save some of the steps as .tbl or data frame before the last pipe. For instance: a %>% b %>% c
, I would like to save the step 'c'
, but also want the step 'b'
.
I know that one option is to do two pipes, but I believe that must have a better way.
cars %>% mutate(kmh = dist/speed) %>% summary()
Thanks for the help. I found a better solution using braces{} and ->>. See below
c = cars %>% mutate(var1 = dist*speed)%>%
{. ->> b } %>% #here is save
summary()
c
head(b)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With