[TxMt] R bundle: Suggestions for 'Insert Command Template'

Hans-Joerg Bibiko bibiko at eva.mpg.de
Tue Dec 19 09:56:53 UTC 2006


Hi,

I look at 'Insert Command Template' and this one of my favorites ;)

Nevertheless I have some humble suggestions to improve it:

1)
Now this command executes the apropos function within a new fresh R  
session. This means that it doesn't know which libraries I'm  
currently using and it doesn't know which functions I defined within  
my R session. To use 'Insert Command Template' also for this you  
should load the function 'getSig.r' in my current session (renamed in  
'.getSig' ) and executes this within my session to get these  
signatures too.
By doing so you would increase the speed of it enormously and you can  
insert signatures for user-defined functions and functions coming  
from loaded libraries.
The disadvantage of it would be that you have such queries in your  
current session; ok you don't see them in the TM R console window,  
but if you save it workspace you would have these.
To avoid this you could think about to write the answer of the query  
into a file and load it in TM.
Or, if you don't interested in the user-defined functions you could  
start a new R session which loads all libraries which are loaded in  
my current session.
(I don't know whether this would also work for user-defined fucntions?)

2)
If you use the approach in 1) then you can do more elaborated things  
with it because of the speed.
Examples:
-If I look for for a keyword it will insert the signature like the  
old version. If there is nothing found it will look for functions  
which begins with the keyword like the old version.
-If I type e.g. 'data.' it lists all methods for 'data.' like  
data.class, data.frame etc. but not 'dataentry'
-If I type e.g. '.difftime' you get all functions where '.difftime'  
is specified like mean.difftime, print.difftime. To insert the  
signature you have to select the keyword in beforehand otherwise it  
shows a tooltip.
-If I have no idea about the complete name of a function you can type  
e.g. '.load.'. This would look for '*load*' as regexp. Furthermore  
sometimes I cannot remember whether the a function is called  
'shownames' or 'showNames', so you can write '.names.' and it looks  
for '*names*|*Names*'.
I would use periods for '.foo.' for indicating this because it will  
be caught be Ruby's getword function.

Of course you can do more things:
-You could catch the 'apropos()' function and run it in TM and print  
the result as pop down menu

and  and  and

What do you think about it?

To change to code would be relatively easy.

Best,
-Hans



More information about the textmate mailing list