Is there a way to source() a script in R such that it is attached as a parent to the global environment (.GlobalEnv)?
Curr
I'm not sure if my answer is any different from the answers given above, but I use the following code:
if (!exists('.env')) .env <- new.env() # creates an environment in which to store functions
if ('.env' %in% search()) detach(.env) # detaches .env if it already exists; does not "erase" functions previously stored in .env
func <- "filenameWhereSourceCodeIsStored"
source(paste0("C:/Users/JT/R/Functions/", func, ".R"), .env)
attach(.env)