Learn R Programming

wrMisc (version 2.1.0)

addBeforeFileExtension: Add Text Before File-Extension

Description

This function helps changing character strings like file-names and allows adding the character vector 'add' (length 1) before the extension (defined by last '.') of the input string 'x'. Used for easily creating variants/additional filenames but keeping current extension.

Usage

addBeforeFileExtension(
  x,
  add,
  sep = "_",
  silent = FALSE,
  callFrom = NULL,
  debug = FALSE
)

Value

modified character vector

Arguments

x

main character vector of file-names

add

character vector to be added

sep

(character) separator between 'x' & 'add' (character, length 1)

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of messages produced

debug

(logical) additional messages for debugging

Details

Since this function replaces the deprecated addBeforFileExtension (to correct a typo in the name of the old version of the function).

Examples

Run this code
addBeforeFileExtension(c("abd.txt","ghg.ijij.txt","kjh"),"new")

Run the code above in your browser using DataLab