# NOT RUN {
local({
# Set the module search path for the example module.
old_opts = options(box.path = system.file(package = 'box'))
on.exit(options(old_opts))
# Basic usage
# The file `box/hello_world.r` exports the functions `world` and `bye`.
box::use(box/hello_world)
hello_world$hello('Robert')
hello_world$bye('Robert')
# Using an alias
box::use(world = box/hello_world)
world$hello('John')
# Attaching exported names
box::use(box/hello_world[hello])
hello('Jenny')
# Exported but not attached, thus access fails:
try(bye('Jenny'))
# Attach everything, give 'world' an alias:
box::use(box/hello_world[hi = hello, ...])
hi('Eve')
bye('Eve')
})
# }
Run the code above in your browser using DataLab