get absolute file path

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

get absolute file path

Sebastian Gibb
Hello,

I get a value which stores a relative file name. (I get it from another
function, which I don't want to change.)
e.g.
> fileName <- "../data/2010-08.csv";

Is it possible to get the absolute file path out of this value?
(e.g. /home/sebastian/documents/data/2010-08.csv)

Kind regards,

Sebastian

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: get absolute file path

Romain Francois
Le 26/09/10 10:00, Sebastian Gibb a écrit :

>
> Hello,
>
> I get a value which stores a relative file name. (I get it from another
> function, which I don't want to change.)
> e.g.
>> fileName<- "../data/2010-08.csv";
>
> Is it possible to get the absolute file path out of this value?
> (e.g. /home/sebastian/documents/data/2010-08.csv)
>
> Kind regards,
>
> Sebastian

Hi,

I often use tools:::file_path_as_absolute which is not exported from the
tools namespace, but does the job.

Romain

--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/cCmbgg : Rcpp 0.8.6
|- http://bit.ly/bzoWrs : Rcpp svn revision 2000
`- http://bit.ly/b8VNE2 : Rcpp at LondonR, oct 5th

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: get absolute file path

steven mosher
In reply to this post by Sebastian Gibb
The package R.utils has a function to get absolutepath

On Sun, Sep 26, 2010 at 1:00 AM, Sebastian Gibb <[hidden email]>wrote:

> Hello,
>
> I get a value which stores a relative file name. (I get it from another
> function, which I don't want to change.)
> e.g.
> > fileName <- "../data/2010-08.csv";
>
> Is it possible to get the absolute file path out of this value?
> (e.g. /home/sebastian/documents/data/2010-08.csv)
>
> Kind regards,
>
> Sebastian
>
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: get absolute file path

Sebastian Gibb
In reply to this post by Romain Francois
Am Sonntag, 26. September 2010, 10:08:39 schrieb Romain Francois:

> Le 26/09/10 10:00, Sebastian Gibb a écrit :
> > Hello,
> >
> > I get a value which stores a relative file name. (I get it from another
> > function, which I don't want to change.)
> > e.g.
> >
> >> fileName<- "../data/2010-08.csv";
> >
> > Is it possible to get the absolute file path out of this value?
> > (e.g. /home/sebastian/documents/data/2010-08.csv)
> >
> > Kind regards,
> >
> > Sebastian
>
> Hi,
>
> I often use tools:::file_path_as_absolute which is not exported from the
> tools namespace, but does the job.
>
> Romain

Hello Romain,

thank you, this function works like expected.
Why is it "hidden"?

Kind regards,

Sebastian

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: get absolute file path

Duncan Murdoch-2
In reply to this post by Romain Francois
On 26/09/2010 4:08 AM, Romain Francois wrote:

> Le 26/09/10 10:00, Sebastian Gibb a écrit :
>> Hello,
>>
>> I get a value which stores a relative file name. (I get it from another
>> function, which I don't want to change.)
>> e.g.
>>> fileName<- "../data/2010-08.csv";
>> Is it possible to get the absolute file path out of this value?
>> (e.g. /home/sebastian/documents/data/2010-08.csv)
>>
>> Kind regards,
>>
>> Sebastian
>
> Hi,
>
> I often use tools:::file_path_as_absolute which is not exported from the
> tools namespace, but does the job.

Or use normalizePath, exported from utils.

Duncan Murdoch

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: get absolute file path

Kurt Hornik-5
In reply to this post by Sebastian Gibb
>>>>> Sebastian Gibb writes:

> Am Sonntag, 26. September 2010, 10:08:39 schrieb Romain Francois:
>> Le 26/09/10 10:00, Sebastian Gibb a écrit :
>> > Hello,
>> >
>> > I get a value which stores a relative file name. (I get it from another
>> > function, which I don't want to change.)
>> > e.g.
>> >
>> >> fileName<- "../data/2010-08.csv";
>> >
>> > Is it possible to get the absolute file path out of this value?
>> > (e.g. /home/sebastian/documents/data/2010-08.csv)
>> >
>> > Kind regards,
>> >
>> > Sebastian
>>
>> Hi,
>>
>> I often use tools:::file_path_as_absolute which is not exported from the
>> tools namespace, but does the job.
>>
>> Romain

> Hello Romain,

> thank you, this function works like expected.
> Why is it "hidden"?

Afaics it is exported and documented.

-k

> Kind regards,

> Sebastian

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: get absolute file path

Romain Francois
Le 26/09/10 12:18, Kurt Hornik a écrit :

>
>>>>>> Sebastian Gibb writes:
>
>> Am Sonntag, 26. September 2010, 10:08:39 schrieb Romain Francois:
>>> Le 26/09/10 10:00, Sebastian Gibb a écrit :
>>>> Hello,
>>>>
>>>> I get a value which stores a relative file name. (I get it from another
>>>> function, which I don't want to change.)
>>>> e.g.
>>>>
>>>>> fileName<- "../data/2010-08.csv";
>>>>
>>>> Is it possible to get the absolute file path out of this value?
>>>> (e.g. /home/sebastian/documents/data/2010-08.csv)
>>>>
>>>> Kind regards,
>>>>
>>>> Sebastian
>>>
>>> Hi,
>>>
>>> I often use tools:::file_path_as_absolute which is not exported from the
>>> tools namespace, but does the job.
>>>
>>> Romain
>
>> Hello Romain,
>
>> thank you, this function works like expected.
>> Why is it "hidden"?
>
> Afaics it is exported and documented.

oops.

--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/cCmbgg : Rcpp 0.8.6
|- http://bit.ly/bzoWrs : Rcpp svn revision 2000
`- http://bit.ly/b8VNE2 : Rcpp at LondonR, oct 5th

______________________________________________
[hidden email] 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.