I am sourcing util functions in production into an environment to encapsulate (and group) the helper functions:
Helper file:
# File: Helper.R
hello <- function() {
print("Hello world")
}
Client:
helper <- new.env()
source("Helper.R", local=helper)
helper$hello() # call the helper function
How can I migrate my sourced "Helper.R" into a library without breaking the calls of the sourced functions?
What I want is something like
helper <- new.env()
library(Helper, local=helper)
helper$hello() # call the helper function (loaded from the library now)
Is there a way to do this?