[R] Creating directories & folders

Cedrick W. Johnson cedrick at cedrickjohnson.com
Mon Jan 25 00:22:49 CET 2010


Try:

for (i in 1:length(folders))  {
dir.create(paste(parent.dir,folders[i], sep="/"))
}


-cedrick

Steven Kang wrote:
> Dear R users,
>
>
> I would like to create the following 3 folders (FUND1, FUND2, MARINE) within
> the 'parent.dir' as defined below.
>
> FUND1 <- "FD1 Q4 2009"
> FUND2 <- "FD2 Q4 2009"
> MARINE <- "MARINE Q4 2009"
>
> parent.dir <- "D:/....................."
>
>
> folders <- c("FUND1", "FUND2", "MARINE")
> for (i in 1:length(folders))  {
>     dir.create(do.call("paste", c(parent.dir, list(folders), sep = "")))
> }
>
> The script above results in error..
>
> Any ideas in resolving this issue would be greatly appreciated.
>
>
>
>
>
>



More information about the R-help mailing list