How can I get the title of a function from a loaded package programmatically? For example ?mean
tells me Arithmetic Mean and ?sd
's title is Standard Deviation. How could I use R to return "Arithmetic Mean"
given the function name mean
?
You can do it using the following:
You will need the Rd_db
function from the tools package to find the rd file of one of the functions (the mean
in this case):
library(tools)
db <- Rd_db("base")
Then save in a variable the .Rd file of interest
therd <- db[grep("mean.Rd", names(db), value = TRUE)]
Finally just print the Title
> c(therd$mean.Rd[[1]][[1]])
[1] "Arithmetic Mean"
In the same way you can actually print other parts of the .Rd file like the description, value etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With