Xu Wang
Xu Wang

Reputation: 10597

source code for autocompletion in R run in terminal

I would like to study the autocomplete code of R, when R is run in a terminal. For example, if you run R from the terminal and type lm( and then tab, R will give you the arguments of lm.

Dirk's answer here suggests that autocompletion of R is supported by the codetools package which is in base R:

Is it possible to get code completion for R in Emacs ESS similar to what is available in Rstudio?

However, I can't find where in that package it adds support for autocomplete. I grepped for 'completion' and came up empty.

Upvotes: 5

Views: 3287

Answers (1)

Gavin Simpson
Gavin Simpson

Reputation: 174853

The completion code is actually in the base instalation in the utils package. You can view everything associated with it (for the devel version) on R's SVN server:

http://svn.r-project.org/R/trunk/src/library/utils/R/completion.R

This code should be read in conjunction with ?completion.

Upvotes: 6

Related Questions