Within RStudio, get the word at cursor location

Hello RStudio Community!

I am experimenting a bit with RStudio. I am interested in how the "Go To Help" and "Go To Function Definition" process works. Are they R functions? I am interested in writing my own R functions that will be turned into addins that can make use of the word a cursor is on. However, I cannot find much information online about these two functions in RStudio.

If they are not R code, how would I go about getting the word my cursor is on? I have been able to use the rstudioapi package to get the selected text with getActiveDocumentContext(), but I would like to simplify the process and just obtain the word my cursor is on and use that word in my function flow.

Any help is appreciated!


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