-2

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?

smci
  • 29,564
  • 18
  • 109
  • 144
xyy
  • 537
  • 4
  • 11

1 Answers1

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
  • 32,615
  • 13
  • 106
  • 186