tempfile {file} R Documentation

Create Names for Temporary Files

Description


tempfile returns a vector of character strings
which can be used as names for temporary files.

Usage

tempfile(
    pattern = "file",
    tmpdir = Call "tempdir"(),
    fileext = ".tmp");

Arguments

pattern

a non-empty character vector giving the initial part of the name.

tmpdir

a non-empty character vector giving the directory name. [as string]

fileext

a non-empty character vector giving the file extension

Details

The length of the result is the maximum of the lengths of the three arguments; values of shorter arguments are recycled.

The names are very likely To be unique among calls To tempfile In an R session And across simultaneous R sessions (unless tmpdir Is specified). The filenames are guaranteed Not To be currently In use.

The file name Is made by concatenating the path given by tmpdir, the pattern String, a random String In hex And a suffix Of fileext.

By Default, tmpdir will be the directory given by tempdir(). This will be a subdirectory of the per-session temporary directory found by the following rule when the R session Is started. The environment variables TMPDIR, TMP And TEMP are checked in turn And the first found which points to a writable directory Is used: If none succeeds the value Of R_USER (see Rconsole) Is used. If the path To the directory contains a space In any Of the components, the path returned will use the shortnames version Of the path. Note that setting any Of these environment variables In the R session has no effect On tempdir(): the per-session temporary directory Is created before the interpreter Is started.

Authors

SMRUCC genomics Institute

Value

a character vector giving the names of possible (temporary) files. Note that no files are generated by tempfile.

clr value class

Examples


[Package file version 2.33.856.6961 Index]