This is a helper function to quickly generate not-terrible filenames. This will be of the form 'day created-author-description.xlsx' Filenames are put in lower-case and spaces are replaced with dashes.

nice_filename(
  name = NULL,
  user = Sys.info()[["user"]],
  time = strftime(Sys.time(), "%Y-%m-%d"),
  ext = ".xlsx",
  dir = NULL,
  replace = FALSE
)

Arguments

name

A brief description of the file

user

The name of the creater of the file

time

The time the file was created (i.e. Sys.time())

ext

The file extension

dir

The directory to save the file to

replace

If FALSE then filenames that already exist will have a number appended to ensure that replacement doesn't occur.

Value

A character vector of length 1

Examples

nice_filename("demo_file", user = "example")
#> [1] "2021-08-26-example-demo_file.xlsx"