Learn R Programming

Kmisc (version 0.5.0)

strip_extension: Strip File Extension

Description

Strips the extension from a file name. By default, we assume the extension is separated from the file name by a single period; however, the lvl argument lets us specify how many periods are used in forming the file extension.

Usage

strip_extension(x, lvl = 1)

Arguments

x
the file name, including extension.
lvl
the number of '.' used in defining the file extension.

Examples

Run this code
x <- "path_to_file.tar.gz"
strip_extension(x, lvl=2)

Run the code above in your browser using DataLab