Well, the %>% operator is borrowed from the magrittr package, which defines the following rules :
- By default, the left side (LHS) will be passed as the first argument to the function that appears on the right side (RHS).
- When LHS is required at a position other than the first, the dot "." as a placeholder.
You can see that the entire data frame is still being passed as the first parameter in this example.
f<-function(...) str(list(...)) dat %>% f(.$b)
So, you get both data.frame and vector (the function takes two parameters). I believe that this is due to the fact that you are not moving . to a position other than the first parameter, so you do not change the behavior to walk through the object as the first parameter.
It so happened that the magrittr package has a different operator for use in such cases. You can use %$% .
library(magrittr) dat %$% all(b)
source share