Displaying 2 results from an estimated 2 matches for "sourceit".
Did you mean:
source_t
2017 Dec 02
0
source files in temp environment
...s, turning the sourced
> code into functions is possible but clunky.
>
> Any thoughts or suggestions would be much appreciated.
I would wrap the calls in the local() function, or put them in a
function and call that. That is,
local({
source("file.R", local = TRUE)
})
or
sourceit <- function() {
source("file.R", local = TRUE)
}
sourceit()
With respect to your last comment (turning the code in file.R into
functions which don't leave their locals behind): I think that would be
the best solution. You may find it clunky now, but in the long run it
like...
2017 Dec 02
2
source files in temp environment
Hi all,
I often keep code in separate files for organizational purposes, and
source() that code from higher level scripts. One problem is that those
sourced files often create temporary variables that I don't want to keep
around. I could clean up after myself with lots of rm()'s, but that's a
pain, and is messy.
I'm wondering if one solution might be to source the code in a