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.
--
Steven
[[alternative HTML version deleted]]
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.
>
>
>
>
>
>
Try this also: sapply(file.path(parent.dir, sapply(folders, get)), dir.create) On Sun, Jan 24, 2010 at 9:01 PM, Steven Kang <stochastickang at gmail.com> 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. > > > > > > -- > Steven > > ? ? ? ?[[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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O