Learn R Programming

pkgmaker (version 0.32.10)

file_extension: Extract File Extension

Description

Extract File Extension

Usage

file_extension(x, ext = NULL)

Value

a character vector.

Arguments

x

path as a character vector.

ext

extension to append instead of the original extension.

Examples

Run this code

file_extension('alpha.txt')
file_extension(paste('aa.tt', 1:5, sep=''))
# change extension
file_extension(paste('aa.tt', 1:5, sep=''), 'pdf')
file_extension(paste('aatt', 1:5, sep=''), 'pdf')

Run the code above in your browser using DataLab