extension.Rd
Get or change a filename extension
extension(filename, value=NULL, maxchar=10)
extension(filename) <- 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
fn <- "c:/temp folder/filename.exten sion"
extension(fn)
#> [1] ""
extension(fn) <- ".txt"
extension(fn)
#> [1] ".txt"
fn <- extension(fn, '.document')
extension(fn)
#> [1] ".document"
extension(fn, maxchar=4)
#> [1] ""