tempfile                package:base                R Documentation

_C_r_e_a_t_e _N_a_m_e_s _f_o_r _T_e_m_p_o_r_a_r_y _F_i_l_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     `tempfile' returns a vector of character strings which can be used
     as names for temporary files in the directory given by `tempdir'.

_U_s_a_g_e:

     tempfile(pattern = "file")
     tempdir()

_A_r_g_u_m_e_n_t_s:

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

_D_e_t_a_i_l_s:

     If `pattern' has length greater than one then the result is of the
     same length giving a temporary file name for each component of
     `pattern'. 

     The names are very likely to be unique among calls to `tempfile'
     in an R session and across simultaneous R sessions.  The filenames
     are guaranteed not to be currently in use.

     The file name is made of the pattern, the process number in hex
     and a random suffix in hex. The filenames will be in the directory
     given by `tempdir()'.  This will be a subdirectory of the
     directory given `TMPDIR' if set, otherwise `"/tmp"'.

_V_a_l_u_e:

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

     For `tempdir', the path of the per-session temporary directory.

_S_e_e _A_l_s_o:

     `unlink' for deleting files.

_E_x_a_m_p_l_e_s:

     tempfile(c("ab", "a b c"))   # give file name with spaces in!

