I see this symbol: %<>%
, in someone's R code and could not find out what it does by googling. Can anyone help shed some light on this?
Asked
Active
Viewed 173 times
-2
-
9It's in the magrittr package. `library(magrittr); help(\`%<>%\`)` – Rich Scriven Nov 22 '15 at 20:56
-
thank you @RichardScriven!!! – xyy Nov 22 '15 at 20:59
1 Answers
1
Functions surrounded by percent symbols such as %<>%
, %in%
, %over%
, %*%
, etc. are called infix operators and, as pointed out by @RichardScriven, can be found in the manual by surrounding them with backticks or quotation marks: ?"%<>%"
or ?`%<>%`
should both bring you to the help pages (GitHub version here; here's the source code)
You can define your own a la:
"%+%" <- function(s1, s2) paste0(s1, s2)
"%U%" <- function(A, B) union(A, B)
And so on. Here's the relevant chapter in Hadley Wickham's book.

MichaelChirico
- 33,841
- 14
- 113
- 198