[R] Checking existance of a directory

Andris Jankevics andza at osi.lv
Fri Oct 29 13:33:55 CEST 2010


Hi, something like this perhaps,

 if("myfolder"%in%dir()==FALSE) dir.create("myfolder")

Command dir.create() is not overwriting an existing folder.

Best regards,
Andris

On Fri, Oct 29, 2010 at 12:08 PM, Ron Michael <ron_michael70 at yahoo.com> wrote:
> Hi all, I am wondering is there any way to check whether some Directory exists or not, given the parent path of that directory? After searching for a while I found that there is a function dir.create() to create some directory. However I need to know whether such directory already exists or not, otherwise I will create that.
>
> Thanks,
>
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at 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.
>
>



More information about the R-help mailing list