Choose.files to give shortnames

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Choose.files to give shortnames

Strongbad78
Hi
I am writing a script to generate a QC report for some data based on a number of files. I am currently using the choose.files function to select the files as not all the files need to be QC'd. One minor issue is that choose.files returns the complete path of the filename (eg "C:/QCdata/Test1/File01", "C:/QCdata/Test1/File02"...). Is it possible to use choose.files to return just the file name eg("File01", "File02"...), in a way similar to the full.names=FALSE argument in the dir function.

Thanks
Tony



        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Choose.files to give shortnames

P Ehlers
Would

basename(choose.files())

work for your usage?
Still, a full.names argument might be useful.

Peter Ehlers

Brooks, Anthony B wrote:

> Hi
> I am writing a script to generate a QC report for some data based on a number of files. I am currently using the choose.files function to select the files as not all the files need to be QC'd. One minor issue is that choose.files returns the complete path of the filename (eg "C:/QCdata/Test1/File01", "C:/QCdata/Test1/File02"...). Is it possible to use choose.files to return just the file name eg("File01", "File02"...), in a way similar to the full.names=FALSE argument in the dir function.
>
> Thanks
> Tony
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Choose.files to give shortnames

Philippe Grosjean
In reply to this post by Strongbad78
Brooks, Anthony B wrote:

 > Hi
 > I am writing a script to generate a QC report for some data based on
a number of files. I am currently using the choose.files function to
select the files as not all the files need to be QC'd. One minor issue
is that choose.files returns the complete path of the filename (eg
"C:/QCdata/Test1/File01", "C:/QCdata/Test1/File02"...). Is it possible
to use choose.files to return just the file name eg("File01",
"File02"...), in a way similar to the full.names=FALSE argument in the
dir function.
 >
 > Thanks
 > Tony


 > basename(choose.files())

Best,

Philippe Grosjean

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Choose.files to give shortnames

Brian Ripley
In reply to this post by P Ehlers
On Wed, 22 Mar 2006, P Ehlers wrote:

> Would
>
> basename(choose.files())
>
> work for your usage?
> Still, a full.names argument might be useful.

I don't think so, as you can change directory in choose.files(), unlike
dir().

> Peter Ehlers
>
> Brooks, Anthony B wrote:
>
>> I am writing a script to generate a QC report for some data based on a
>> number of files. I am currently using the choose.files function to
>> select the files as not all the files need to be QC'd. One minor issue
>> is that choose.files returns the complete path of the filename (eg
>> "C:/QCdata/Test1/File01", "C:/QCdata/Test1/File02"...). Is it possible
>> to use choose.files to return just the file name eg("File01",
>> "File02"...), in a way similar to the full.names=FALSE argument in the
>> dir function.


--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel