Reputation: 47320
Here are some of my addins :
For example, I'd like to know programmatically what function is called by "reprex" for the addin "Reprex selection".
If I go to the repo and browse to "reprex/inst/rstudio/addins.dcf" I can see that it is reprex:::reprex_selection()
.
So I wish to have :
magic("reprex", "Reprex selection")
# [1] "reprex_selection"
Returning the function without naming it would work too.
Upvotes: 1
Views: 90
Reputation: 44897
You can read that addins.dcf
file with read.dcf()
:
magic <- function(package, name) {
addins <- read.dcf(system.file("rstudio/addins.dcf", package = package))
with(as.data.frame(addins), Binding[Name == name])
}
magic("reprex", "Reprex selection")
#> [1] "reprex_selection"
Created on 2021-09-13 by the reprex package (v2.0.0)
Upvotes: 2