DuckPyjamas
DuckPyjamas

Reputation: 1659

How do I view syntax-highlighted source code for operators e.g. %in%?

In RStudio, I know that if I press F2 while the caret is on a function name I will be shown the source code for that function as if it was an open R script, which syntax highlighting and everything.

How do I do the same for operators like %in% and names like if? These things don't work:

  1. Typing %in% into the script or console and pressing F2/Go To Definition.
  2. Typing `%in%` (surrounded by backticks) into the script or console and pressing F2/Go To Definition.

The only way I can view their source code is by running `%in%` in the console, where it shows me an unhighlighted version.

Thanks!

Upvotes: 4

Views: 85

Answers (1)

morgan121
morgan121

Reputation: 2253

You can see them by using View() with backticks around the argument:

View(`%in%`)
View(`if`)

Upvotes: 4

Related Questions