Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

source code for autocompletion in R run in terminal

Tags:

autocomplete

r

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.

like image 929
Xu Wang Avatar asked Nov 10 '12 08:11

Xu Wang


1 Answers

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.

like image 59
Gavin Simpson Avatar answered Oct 19 '22 11:10

Gavin Simpson