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
?
答案 0 :(得分:4)
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.