[R] If statement generates two outputs
Wacek Kusnierczyk
Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Mon Mar 23 08:39:56 CET 2009
jimdare wrote:
> Hi,
>
> I tried to create the following if / else statement but I keep getting the
> error "Error: unexpected '}' in "size="large",center="none")
> }" (I have highlighted the } in bold where the error is occuring). I can't
> seem to find a reason for this, does anyone know how I can fix it?
>
> Thanks,
> James
>
> if (nostocks<=3)
>
> {data1<-test[,data1stocks];
> tex1<-latex(data1, file=paste(i$Species[1], "1.tex", sep=""),
> rowname = NULL,
> cgroup = c("Fishstock", stocknames,"Total"),
> n.cgroup = c(1, rep(2,(nostocks+1)),
> colheads = c("Year", rep(c("Catch", "TACC"),
> nostocks+1)),
> size="large",center="none")
>
> }else)
>
the error message tells you that '}' is unexpected here, and that's
because it really is. you forgot to close one parenthesis up there:
n.cgroup = c(1, rep(2,(nostocks+1)),
you open three, you close two. close three and it goes away.
vQ
More information about the R-help
mailing list