This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/tempfile.html
tempfile {base}R Documentation

Create Unique Names for (Temporary) Files

Usage

tempfile(pattern = "file")

Arguments

pattern

a character vector with the beginnings of the returned file names.

Value

A character vector giving of names of possible (temporary) files. The names are certain to be unique between subsequent calls. Note that no files are generated by tempfile.

Examples

## One possibility of getting ALL environment variables,
## compare with `getenv':
fun <- function() {
  FILE <- tempfile("fun")
  on.exit(unlink(FILE))
  system(paste("printenv >", FILE))
  x <- strsplit(scan(FILE, what = ""), "=")
  v <- n <- character(LEN <- length(x))
  for (i in 1:LEN) {
    n[i] <- x[[i]][1]
    v[i] <- paste(x[[i]][-1], collapse = "=")
  }
  structure(v, names = n)
}
fun()

[Package base version 0.60 ]