7

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?

merlin2011
  • 71,677
  • 44
  • 195
  • 329
  • 6
    Why the downvote? I'm not sure how I was expected to know this a priori. – merlin2011 Nov 03 '13 at 19:05
  • @AnandaMahto: post as answer please ... – Ben Bolker Nov 03 '13 at 19:10
  • If Ananda doesn't post his comment as an answer in a few more minutes, I'll go ahead and accept the answer below. – merlin2011 Nov 03 '13 at 19:16
  • 1
    You may also wish to read [this](http://cran.r-project.org/doc/manuals/R-intro.html#Getting-help). '"For a feature specified by special characters, the argument must be enclosed in double or single quotes, making it a “character string”' And from the `help` help pages: "Some topics need to be quoted (by backticks) or given as a character string.". – Henrik Nov 03 '13 at 19:23

1 Answers1

8

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
B.Mr.W.
  • 18,910
  • 35
  • 114
  • 178