Learn R Programming

rmake (version 1.2.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)

Value

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

Arguments

fileName

A character vector with original filenames

newSuffix

A new extension to replace old extensions in file names fileName

Author

Michal Burda

Examples

Run this code
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