Skip to contents

Get a safe name to export a file without overwriting

Usage

get_safe_file_name(
  data,
  name = NULL,
  format = "xlsx",
  overwrite = FALSE,
  time_in_name = FALSE
)

Arguments

data

The object to be exported.

name

A desired name for the exported file. If no name is provided, the file will inherit the object's name.

format

The format of the exported file. Default is 'xlsx'.

overwrite

A logical to indicate whether preexisting files with identical names should be overwritten. Default is 'FALSE'.

time_in_name

A logical to indicate whether a timestamp should be included in the file's name.

Value

A safe name for exporting the file, as a "character string", and also indicated in a message.

Examples

# \donttest{
if (FALSE) {
  library(phdcocktail)
  get_safe_file_name(mtcars)
}
# }