Learn R Programming

Kmisc (version 0.2.0)

kStripExtension: 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

kStripExtension(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"
kStripExtension(x, lvl=2)

Run the code above in your browser using DataLab