From deepayan.sarkar at gmail.com  Thu Oct  8 20:38:16 2009
From: deepayan.sarkar at gmail.com (Deepayan Sarkar)
Date: Thu, 8 Oct 2009 11:38:16 -0700
Subject: [Rd] Improved Function Information with <TAB> Key
In-Reply-To: <ad203a770910080533l70d1e246hb16d714e80aae968@mail.gmail.com>
References: <ad203a770910070556p86710ddy18dc2f5be6926127@mail.gmail.com>
	<eb555e660910080237k23c6421bq465eef05bcd91e07@mail.gmail.com>
	<ad203a770910080533l70d1e246hb16d714e80aae968@mail.gmail.com>
Message-ID: <eb555e660910081138x3c584fdex8c5c06a639d68d90@mail.gmail.com>

On Thu, Oct 8, 2009 at 5:33 AM, Lee Kelvin <lee.s.kelvin at gmail.com> wrote:
> Thanks for the responses,
>
> Im not familiar with the development of readline 6, is it possible to test
> this functionality now, or will this be included in a future standard
> release of R?

I don't think it's possible to test it now (but I can't say for sure
as I don't have readline 6 installed and haven't read the
documentation carefully). In theory, some future release should
include a check for readline>=6 and disable sorting, but I'm not sure
when or if that will happen in practice.

> Also, it was suggested that Emacs and the ESS package may be of use.? Im not
> overly familiar with emacs, but I will give it a go.

As far as I can tell, Emacs' completion system also sorts, and I don't
see a way to inhibit that. ESS does show you the results of args()
when you type an open paren after a function name, which should be
useful for you.

-Deepayan

>
> Thanks,
> ??? Lee Kelvin
>
>
> 2009/10/8 Deepayan Sarkar <deepayan.sarkar at gmail.com>
>>
>> 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.
>>
>> -Deepayan
>
>
>
> --
> Lee Kelvin
>
> lee.s.kelvin at gmail.com
> 07765431721
>



[Rd] Improved Function Information with <TAB> Key
Deepayan Sarkar