Hello,

You can use ?basename to write a file.stem function:


basename("/the/path/to/afile.txt")

file.stem <- function(x){
        bn <- basename(x)
        gsub("\\..*$", "", bn)
}
file.stem("/the/path/to/afile.txt")



Hope this helps,

Rui Barradas

Em 15-07-2013 15:23, Witold E Wolski escreveu:
Looking for a function which returns the stem of the filename given a path.
i.e.
file.stem("/the/path/to/afile.txt")
afile

regards


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to