[R] Problem with dir.create (R2.2.0 Windows XP 2002 SP 2)

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Dec 14 23:16:10 CET 2005


One comment is that Windows does not like trailing directory separators as 
in

print(dir.create("d:\\otis-sim\\", recursive=T))

and so this will give a warning as in

> print(dir.create("d:\\otis-sim\\", recursive=T))
[1] FALSE
Warning message:
'd:\otis-sim\' already exists

Beyond that, the code is designed for Unix-like file systems and does not 
expect drives.

setwd("d:/")
print(dir.create("\\otis-sim\\foo", recursive=T))

seems to work reliably.  The issue seems to depend on what the current 
directory on the drive is (if a drive is specified), and I've made an 
adjustment for 2.2.1 to workaround that.


On Wed, 14 Dec 2005, Liaw, Andy wrote:

> No problem for me (Version 2.2.0  (2005-10-06 r35749), WinXPPro SP2):
>
>> setwd("q:/")
>> print(dir.create("q:/Andy/what/is/this", recursive=TRUE))
> [1] TRUE
>> setwd("c:/")
>> print(dir.create("q:/Andy/what/is/that/thing", recursive=TRUE))
> [1] TRUE
>
> Andy
>
> From: hadley wickham
>>
>> I've run into a problem with dir.create on R2.2.0 Windows XP
>> 2002 SP 2.
>>
>> setwd("d:/")
>> print(dir.create("d:\\otis-sim\\rdata", recursive=T))
>> print(dir.create("d:\\otis-sim\\", recursive=T))
>>
>> Both return false and fail to create the directories.
>>
>> setwd("c:/")
>> print(dir.create("d:\\otis-sim\\rdata", recursive=T))
>>
>> Returns true and succesfully creates the directories.
>>
>> Why does this occur?
>>
>> Hadley
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>>
>>
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
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




More information about the R-help mailing list