Learn R Programming

rmake (version 1.1.0)

replaceSuffix: Replace suffix of the given file name with a new extension (suffix)

Description

This helper function takes a file name fileName, removes an extension (a suffix) from it and adds a new extension newSuffix.

Usage

replaceSuffix(fileName, newSuffix)

Arguments

fileName

A character vector with original filenames

newSuffix

A new extension to replace old extensions in file names fileName

Value

A character vector with new file names with old extensions replaced with newSuffix

Examples

Run this code
# NOT RUN {
replaceSuffix('filename.Rmd', '.pdf')          # 'filename.pdf'
replaceSuffix(c('a.x', 'b.y', 'c.z'), '.csv')  # 'a.csv', 'b.csv', 'c.csv'
# }

Run the code above in your browser using DataLab