In R, with get() call a function from an unloaded package without using library -
i want call function unloaded package having function name stored in list.
normally use
library(shiny) pagelist <- list("type" = "p") # object function name (will loaded .txt file) get(pagelist$type[1])("display text")
but since when writing package you're not allowed load library i'd have use like
get(shiny::pagelist$type[1])("display text")
which doesn't work. there way call function function name stored in list, without having load library? note should possible call many different functions (all same package), using e.g.
if (pagelist$type[1] == "p"){ shiny::p("display text") }
would require quite long list of if else statemens.
use getexportedvalue
:
getexportedvalue("shiny",pagelist$type[1])("display text") #<p>display text</p>
Comments
Post a Comment