raster (version 1.0.4)

extension: Filename extensions

Description

Get or change a filename extension

Usage

ext(filename, value=NULL)
ext(filename) <- value

Arguments

filename
A filename, with or without the path
value
A file extension including the dot, e.g., ".txt"

Value

  • A file extension, filename or path. If ext(filename) is used without a value argument, it returns the file extension; otherwise it returns the filename (with new extions set to value

Examples

Run this code
fn <- "c:/temp folder/filename.exten sion"
ext(fn)
ext(fn) <- ".txt"
ext(fn)
ext(fn, '.document')

Run the code above in your browser using DataCamp Workspace