clean_filename: Clean Filename

View source: R/clean.R

clean_filenameR Documentation

Clean Filename

Description

This function is primarily useful for removing any apostrophe from the filename since this will get rejected by Google Drive, but also includes features like replacing spaces with an underscore, converting to all lowercase, and adding a date prefix or suffix.

Usage

clean_filename(
  x,
  rm_apostrophe = TRUE,
  rp_space = FALSE,
  mk_lower = FALSE,
  add_date = NULL
)

Arguments

x

filepath or file name

rm_apostrophe

remove all apostrophes, default = TRUE

rp_space

replace spaces with underscore, default = FALSE

mk_lower

make lowercase, default = FALSE

add_date

add date "prefix" or "suffix"

Value

clean filename

Examples

## Not run: 
file <- "Submission_Coted'Ivoire_data.csv"
new_file <- clean_filename(file, rm_apostrophe = TRUE, add_date = 'prefix') 
## End(Not run)

USAID-OHA-SI/glamr documentation built on Oct. 1, 2024, 2:18 p.m.