Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one look up documentation for infix operators in R? [duplicate]

Tags:

r

Normally when I want to look up a function's documentation in R, I can just type ?lm, or to do a search for it among various packages, I can type ??lm. However, this does not appear to work for infix operators. For example, when I do ?%*%, I get the following message.

> ?%*%
Error: unexpected SPECIAL in "?%*%"

Is there a way to look up documentation for such functions / operators in general in R?

like image 513
merlin2011 Avatar asked Nov 03 '13 19:11

merlin2011


People also ask

What is an infix operator in R?

Infix operators (also called “infix functions”) provide that different format, a syntax for pairing arguments while providing a mathematical order of expressions recognized by the program.

What does %/% mean in R?

%/% gives Quotient. So 6 %% 4 = 2. In your example b %% a , it will vectorised over the values in “a”


1 Answers

For basic operators you need to put quotes around them.

Also here is a list of R base package functions for you to play around with.

?"%*%"
# matmult {base}    R Documentation
# Matrix Multiplication ... 

? "'"
# Quote
# Quotes {base} R Documentation
# Quotes ...

Also has hadley mentioned:

?"?"
# Question {utils}  R Documentation
# Documentation Shortcuts ...
?"??"
# help.search {utils}   R Documentation
# Search the Help System
like image 115
B.Mr.W. Avatar answered Oct 10 '22 11:10

B.Mr.W.