[R] if block and brackets
Fred J.
phddas at yahoo.com
Thu Mar 25 02:23:32 CET 2004
Hello
the maunal states "When the if statement is not in a
block the else, if present, must appear on the same
line as statement1. Otherwise the new line at the end
of statement1 yields a syntactically complete
statement that is evaluated."
well, what is wrong with this if structure? I am
getting an error on the line where "else" is
thanks
if (exists("f")){
dt <- read.csv(file.path(d,f),header=F)#data frame
builddl(dt,f)
else
for (i in dir(d)){
dt <-
read.csv(file.path("c:/data",i),header=F)#data frame
an <- sub("([^.]+)(\\..+)","\\1", i))
builddl(dt,an)
}
}
More information about the R-help
mailing list