set. {unixtools}R Documentation

Change R's temporary directory

Description

set.tempdir changes the directury returned by tempdir(). It should only be used after forking (in particular when switching users) so that multiple processes don't share the temporary directory.

Usage

set.tempdir(path)

Arguments

path

string, path to use as the temporary directory

Details

Normally tempdir() is created and initialized on R startup and should not be changed. However, when using fork() the child process inherits the same directory which may not be desirable, in particular when the child wants to use set.user to change the owner. In such cases set.tempdir can be used to change the temporary directory that R will be using.

path will be passed to path.expand first.

Value

The newly set path

Note

set.tempdir does not check that the path is valid and/or writable. it is th eusere's responsibility to create teh path and then use set.tempdir, otherwise R may not function properly.

Author(s)

Simon Urbanek

Examples

## Not run: 
## create process-specific tempdir
dir.create(t <- paste(tempdir(), Sys.getpid(), sep='-'), FALSE, TRUE, "0700")
set.tempdir(t)

## End(Not run)

[Package unixtools version 0.1-1 Index]