Description Usage Arguments Value See Also Examples
Import specific functions from an outsider module to the Global Environment.
1 | module_import(fname, repo)
|
fname |
Function name to import |
repo |
Module repo |
Function
Other public:
is_module_installed()
,
module_details()
,
module_functions()
,
module_help()
,
module_installed()
,
module_install()
,
module_search()
,
module_uninstall()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | library(outsider)
if (is_outsider_ready()) {
# simplest repo
repo <- 'dombennett/om..hello.world'
# is module_installed?
if (is_module_installed(repo = repo)) {
# get help for package
module_help(repo = repo)
# list functions available
module_functions(repo = repo)
# import
hello_world <- module_import(fname = 'hello_world', repo = repo)
# get help for function
module_help(repo = repo, fname = 'hello_world')
# also works
?hello_world
# run function
hello_world()
# change verbosity settings
# print nothing to console
verbosity_set(show_program = FALSE, show_docker = FALSE)
hello_world()
# print everything to console
verbosity_set(show_program = TRUE, show_docker = TRUE)
hello_world()
# write program output to a file
log_file <- tempfile()
verbosity_set(show_program = log_file, show_docker = FALSE)
hello_world()
(readLines(con = log_file))
# Clean up
file.remove(log_file)
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.