Code text prediction in RStudio

Is there any add-in for RStudio (or some other software/IDE), that would go through all my past R codes (saved in some folder), and try to predict what I am about to type, or show in which files I have used this function before?

For example at the moment prediction works well for known (installed packages). Like when we type lapply( + [TAB] window pops up with suggestion about arguments and help excerpt.

image

This is great, but when we vaguely remember the function name/package and start typing, and it will try to guess, and point to previous R files where I have used the similar functions. For example: when I type venn, it will pop up as:

someOldScript123.R | venn::venn(...                | #Line23
someOldScript444.R | VennDiagram::venn.diagram(... | #Line345
someOldScript123.R | gplots::venn(...              | #Line999
etc.

Sorted by frequency of usage.

2 Likes

Are you thinking about something like Smart Compose, but for code?

There's a nice description of how RStudio autocomplete works here (though I don't think it does what you're describing):

Not totally sure how this works, but it's a VS Code add-on that does autocomplete based on all open documents (so it wouldn't be a saved stash, but I guess you could open them all…)

Same goes for IntelliSense, which, in my experience doing some coding in other languages in VS Code, definitely suggests things that are words but not commands:

1 Like

Thank you Mara, yes, I more mean "Smart Compose", not code completion (which is great as it is now).

I remember seeing similar feature (maybe wasn't for R) somewhere on Twitter but can't find it anymore...

Well, definitely report back if you think of it! The closest I can imagine right now is to create a gmail account where you write all of your code. Obviously that has some other drawbacks. :joy:

1 Like

for Python there's a project called Kite that is doing something like this:

4 Likes

Yes, thank you @jdlong, kite.com was the name I was looking for, unfortunately not for R, yet.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.