Is the %>%
pipe operator always feeding the left-hand side (LHS) to the first argument of the right-hand side (RHS)? Even if the first argument is specified again in the RHS call?
Say I want to specify which variable to use in cor()
:
library(magrittr)
iris %>%
cor(x=.$Sepal.Length, y=.$Sepal.Width)
But this fails, it looks like it call something like cor(., x=.$Sepal.Length, y=.$Sepal.Width)
?
I know I could use instead
iris %$%
cor(x=Sepal.Length, y=Sepal.Width)
But wanted to find a solution with %>%
...