basename2: Improved 'basename'.

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Simply a wrapper around basename that allows removing the extension part from file names.

Usage

1
basename2(path, ext = NULL)

Arguments

path

Path name.

ext

Extension to be excluded. If NULL, just use basename.

Details

The R function basename^is very useful when writing scripts but often it is necessary to change the extension. The UNIX utililty basename allows for a second argument the provides a termination suffix that can be excluded.

Value

Basename of the path.

Examples

1
2
print(basename2("/home/file.txt"))
print(basename2("/home/file.txt", ext='.txt'))

tunelipt/wutils documentation built on Nov. 5, 2019, 11:01 a.m.