timestamp_it: Append a timestamp to 'x', typically a path

View source: R/misc.R

timestamp_itR Documentation

Append a timestamp to x, typically a path

Description

This function just appends a timestamp (format YYYYMMDDHHMMSS), separated by an underscore (_) to whatever x is (so, x is coerced to character). By default, it assumes x is a path and then adds the timestamp before the last extension (if there is any).

Usage

timestamp_it(x, is_path = TRUE)

Arguments

x

a character or an object coercible to character

is_path

logical to indicate if x is a path, then it removes extension before appending the timestamp

Value

a character appending a timestamp to x

Examples

# typical usage
timestamp_it("this/path/may/not/exist/")
timestamp_it("this/path/may/not/exist.txt")
# weird usage
timestamp_it(mtcars, FALSE)

edalfon/efun documentation built on June 23, 2024, 4:17 a.m.