How to create a directoy with R

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

How to create a directoy with R

pau carre
Hello, I am trying to create directories with R. I would like R to
create directories because it is platform independent. I tried using
file() and searching in "R Data Import/Export" but I did not succeed.
I think it must be some function since exists the unlink to remove
directories (and files).

Pau

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

Re: How to create a directoy with R

David Whiting
?dir.create

On Mon, 2006-03-27 at 13:07 +0200, pau carre wrote:

> Hello, I am trying to create directories with R. I would like R to
> create directories because it is platform independent. I tried using
> file() and searching in "R Data Import/Export" but I did not succeed.
> I think it must be some function since exists the unlink to remove
> directories (and files).
>
> Pau
>
> ______________________________________________
> [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

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

Re: How to create a directoy with R

Sarah Goslee
In reply to this post by pau carre
I think you need to use system("mkdir") or whatever is appropriate
for your OS. Making directories is a function of the OS, not of R. If
you need to make a truly cross-platform solution, you might need
to check within your code what OS is being used, and call the
appropriate system statement. (I think you can do this, but have
never needed to.) That would be particularly important if you need to
specify paths.

Sarah

On 3/27/06, pau carre <[hidden email]> wrote:

>
> Hello, I am trying to create directories with R. I would like R to
> create directories because it is platform independent. I tried using
> file() and searching in "R Data Import/Export" but I did not succeed.
> I think it must be some function since exists the unlink to remove
> directories (and files).
>
> Pau
>
> ______________________________________________
> [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
>



--
Sarah Goslee
http://www.stringpage.com

        [[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
Reply | Threaded
Open this post in threaded view
|

Re: How to create a directoy with R

Brian Ripley
In reply to this post by pau carre
On Mon, 27 Mar 2006, pau carre wrote:

> Hello, I am trying to create directories with R. I would like R to
> create directories because it is platform independent. I tried using
> file() and searching in "R Data Import/Export" but I did not succeed.
> I think it must be some function since exists the unlink to remove
> directories (and files).

?dir.create

[help.search("directory") leads to

files(base)             File and Directory Manipulation

on which page it is documented.]

--
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-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: How to create a directoy with R

Liaw, Andy
In reply to this post by pau carre
help.search("directory") would have given you:


R.home(base)            Return the R Home Directory
files(base)             File and Directory Manipulation
getwd(base)             Get or Set Working Directory
list.files(base)        List the Files in a Directory/Folder
unlink(base)            Delete Files and Directories

and then ?files would have told you there's dir.create() and how to use it.

Andy


From: pau carre

>
> Hello, I am trying to create directories with R. I would like
> R to create directories because it is platform independent. I
> tried using
> file() and searching in "R Data Import/Export" but I did not
> succeed. I think it must be some function since exists the
> unlink to remove directories (and files).
>
> Pau
>
> ______________________________________________
> [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
>
>

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

Re: How to create a directoy with R

Philippe Grosjean
In reply to this post by Sarah Goslee
See ?dir.create, and take care at the 'recursive' argument in case you
have to create several subdir levels at once.
Best,

Philippe Grosjean

Sarah Goslee wrote:

> I think you need to use system("mkdir") or whatever is appropriate
> for your OS. Making directories is a function of the OS, not of R. If
> you need to make a truly cross-platform solution, you might need
> to check within your code what OS is being used, and call the
> appropriate system statement. (I think you can do this, but have
> never needed to.) That would be particularly important if you need to
> specify paths.
>
> Sarah
>
> On 3/27/06, pau carre <[hidden email]> wrote:
>
>>Hello, I am trying to create directories with R. I would like R to
>>create directories because it is platform independent. I tried using
>>file() and searching in "R Data Import/Export" but I did not succeed.
>>I think it must be some function since exists the unlink to remove
>>directories (and files).
>>
>>Pau
>>
>>______________________________________________
>>[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
>>
>
>
>
>
> --
> Sarah Goslee
> http://www.stringpage.com
>
> [[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
>
>

______________________________________________
[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