-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
  • 32,567
  • 20
  • 113
  • 146
xyy
  • 547
  • 1
  • 5
  • 12

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
  • 33,841
  • 14
  • 113
  • 198