extension

0th

Percentile

Filename extensions

Get or change a filename extension

Keywords
file
Usage
extension(filename, value=NULL, maxchar=10)
extension(filename) <- value
Arguments
filename

A filename, with or without the path

value

A file extension with or without a dot, e.g., ".txt" or "txt"

maxchar

Maximum number of characters after the last dot in the filename, for that string to be considered a filename extension

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 extensions set to value

Aliases
  • extension
  • extension<-
Examples
# NOT RUN {
fn <- "c:/temp folder/filename.exten sion"
extension(fn)
extension(fn) <- ".txt"
extension(fn)
fn <- extension(fn, '.document')
extension(fn)
extension(fn, maxchar=4)
# }
Documentation reproduced from package raster, version 2.9-5, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.