0

I am working on an R GUI with the shiny package. In the GUI, I am trying to create tooltips for multiple functions which are provided through other R-packages. So my idea was to parse the necessary information for the tooltips from the documentation (help-files) of the respective packages. So, for example, one such tooltip might be to show the description text from the help files.

My current problem is that I can't find any way to parse the output of the R help into a string or other type of variable that I can then further process.

For example:

?sum

opens a help page with the description:

sum returns the sum of all the values present in its arguments.

Now if i try something like:

capture.output(?sum)
paste(?sum)

I won't get any helpful results.

Is there a way to directly parse a help file into a string etc.?

Thanks for your help ;)

1 Answers1

0

Just to give a quick summary of the solution that was given to me in the comment by Nate: I wrote a short method to extract a help file by package- and method-name.

library(tools)
getMethodHelp <- function(packageName, methodName){
    db <- Rd_db(packageName)
    return(db[[paste0(methodName,".Rd")]])
}

And maybe a usage example:

getMethodHelp("base","sum")

Returns the helpfile of the sum function from the base-package.

Hope this helps someone in the future....