Looking for a function which returns the stem of the filename given a path. i.e.> file.stem("/the/path/to/afile.txt") > afileregards -- Witold Eryk Wolski [[alternative HTML version deleted]]
Read the Posting Guide... use plain text email.
help.search("file")
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
Witold E Wolski <wewolski at gmail.com> wrote:
>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
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
>