Skip to contents

Lowercases, replaces every run of non-alphanumeric characters with a single -, and strips leading and trailing dashes.

Usage

.sanitize_filename(x)

Arguments

x

A character vector.

Value

A character vector of the same length.

Details

The collapsing is what the rest of write_by_group()'s filename scheme rests on: because a run of separators becomes exactly one dash, a sanitized value can contain a single - but never two consecutive ones. That leaves -- free to mark the boundary between grouping columns without any possibility of colliding with content.

Not exported. Confirmed as internal-only against the package's own NAMESPACE (0.5.1.9000) rather than assumed: nothing outside write_by_group(), the only place that calls it, needs this directly.