r - Pipe a data frame to a function whose argument pipes a dot -


how can 1 pipe data frame function argument pipes dot?

mpg %>% rbind(., . %>% rev()) 

error in rep(xi, length.out = nvar) : attempt replicate object of type 'closure'

another example:

mpg %>%   {     . %>% arrange(manufacturer)   } 

functional sequence following components:

  1. arrange(., manufacturer)

use 'functions' extract individual functions.

wrap dot piped in parentheses (.):

mpg %>% rbind(., (.) %>% rev()) 

or, lambda function:

mpg %>%   {     (.) %>% arrange(manufacturer)   } 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -