[Rd] Improved Function Information with <TAB> Key

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Oct 8 11:37:40 CEST 2009

On Wed, Oct 7, 2009 at 5:56 AM, Lee Kelvin <lee.s.kelvin at gmail.com> wrote:
> Hello,
> Pressing the <TAB> key when typing a function into an R terminal does not
> produce the expected output.  Currently, R will order all of the available
> function inputs into alphabetical order and present them as options, whereas
> it should display the inputs in the order they appear in the function.
> For example:
>> test = function(b,a,c){
> print(b)
> a*c
> }
>> test(   <TAB><TAB>
> a=  b=  c=
> where <TAB> indicates pressing the Tab key.
> It's easy to see that if the function were designed to accept 'b' as a
> string, and 'a' and 'c' as numerics that this function would fail if the
> user made the assumption that the <TAB> output is in the correct order, and
> input 'a' as a string.
> This is a simple example, however I have several functions that I use often
> and each has many possible inputs.  It would be useful to not have to
> remember the order the inputs are in for each function, or have to use
> args(function) beforehand.  It is also on occasion useful not to have to
> explicitly name each input in your function.
> Im using Ubuntu Linux 9.04 and a standard install of R 2.9.2 (unfortunately
> not the polished R.app available on Macs - which coincidentally do display
> function inputs in the correct order).
> I welcome any thoughts, disagreements or tips any of you may have,

The sorting is a feature of the readline library that is used as the
backend (there is no sorting on the Windows GUI). Apparently readline
6 allows you to inhibit sorting, so that might turn out to be useful.


More information about the R-devel mailing list