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:
- arrange(., manufacturer)
use 'functions' extract individual functions.
wrap dot piped in parentheses (.)
:
mpg %>% rbind(., (.) %>% rev())
or, lambda function:
mpg %>% { (.) %>% arrange(manufacturer) }
Comments
Post a Comment