Created
April 3, 2013 13:42
-
-
Save klmr/5301304 to your computer and use it in GitHub Desktop.
(Incomplete) simple module mechanism for R.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import <- function (module) { | |
module <- as.character(substitute(module)) | |
# Search path handling omitted for simplicity. | |
filename <- paste(module, 'R', sep = '.') | |
includeGuard <- paste('.INCLUDE', toupper(module), 'R', sep = '_') | |
if (exists(includeGuard)) | |
return() | |
assign(includeGuard, TRUE, envir = topenv()) | |
sys.source(filename, chdir = TRUE) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment