test <- c(1,2,0,5,0)
which(test == 0)
test %>% which(.==0)
test %>% which(,==0)
test %>% which( ==0)
I am trying to figure out how to pipe a vector into the which() function. Using which(test == 0) gives me the desired result but using a pipe on the last three lines all give me errors. How can I get the same result as which(test == 0) but using a pipe?
Use {...} to prevent dot from being inserted into
which. Without the brace brackets it would have inserted dot as a first argument as inwhich(., . == 0).With magrittr we can use
equalsTo use |> create a list containing
testwhere the component name is dot.