Skip to contents

A helper function to create consistent file names for plots created with ggsave_ext() or data files exported with write_sf_ext().

Usage

make_filename(
  name = NULL,
  label = NULL,
  filetype = NULL,
  filename = NULL,
  path = NULL,
  prefix = NULL,
  postfix = NULL,
  cache = FALSE,
  pad = NULL,
  width = NULL
)

Arguments

name

Name to make file name converted to snake case with janitor::make_clean_names(), e.g. "Residential zoning map" becomes "residential_zoning_map"

label

Label to combine with name converted to snake case with janitor::make_clean_names(). The label is designed to identify the area or other shared characteristics across multiple data files, maps, or plots.

filetype

File type or extension.

filename

File name; if file name is NULL, name and file type are both required.

path

Path to file or data directory.

prefix

File name prefix. "date" adds a date prefix, "time" adds a date/time prefix; defaults to NULL.

postfix

File name postfix; defaults to NULL.

cache

If TRUE, path is set to the overedge cache directory using get_data_dir(); defaults to FALSE.

pad

Single padding character added to digits in string; defaults to "0"

width

Minimum width of padded strings.

See also

Other read_write: read_sf_exif(), read_sf_ext()