Last active
September 2, 2021 20:42
-
-
Save MyKo101/19b57e3cb9fba08d56cdd6ffc8bb088f to your computer and use it in GitHub Desktop.
Load Folder as Environment
This file contains hidden or 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
| temp_env <- new.env() #Create a new environment | |
| if("LoadedEnv" %in% search()) detach("LoadedEnv") #If this has previously been run, remove it! | |
| ff <- list.files("functions",full.names=TRUE) #Load up the files in the functions folder | |
| silencer <- lapply(ff,source,local=temp_env) #source them all into the temporary environment | |
| attach(temp_env,name="LoadedEnv") #Add the environment to the search path | |
| rm(temp_env,ff,silencer) #Clean up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment