I want the index of an element in a vector x
x <- c("apple", "banana", "peach", "cherry")
With base R i would do that
which(x == "peach")
But as my x is at the end of a pipe I would like to get the index the magrittr way.
x %>% getIndex("peach")
My desired output is 3.