I am looking for a way to change the tempdir() location after an R session has started. I think it would be required to update the C level global variable
tempdir()
If you unlock tempdir() and re-assign a new function to the baseenv() it might work:
baseenv()
tempdir <- function() "/NewTempDir" unlockBinding("tempdir", baseenv()) assignInNamespace("tempdir", tempdir, ns="base", envir=baseenv()) assign("tempdir", tempdir, baseenv()) lockBinding("tempdir", baseenv())