This github issue discusses the topic : https://github.com/r-lib/callr/issues/172. Here is a workaround usable from within an R session:
Sys.setenv(TMPDIR = "MY TEMP DIRECTORY") unlink(tempdir(), recursive = TRUE) tempdir(check = TRUE) tempdir()