Learn R Programming

bayescount (version 0.8.2)

new_unique: CREATE A UNIQUE FILENAME

Description

Search the current working directory for a file or directory matching the input name, and if it exists suggest a new name by appending a counter to the input name. Alternatively, the function can ask the user if the existing file should be overwritten, in which case the existing file will be erased if the answer is 'yes'. The function also checks for write access permissions at the current working directory. Used by the bayescount function.

Usage

new_unique(name, suffix = "", ask = FALSE, prompt = "A file or directory with this name already exists.  Overwrite?")

Arguments

Value

A unique filename that is safe to use without fear of destroying existing files

See Also

bayescount

Examples

Run this code
#  Create a file name with a .R extension.
new_unique("new_file", ".R", ask=FALSE)

Run the code above in your browser using DataLab