[R] A statement over multiple lines (i.e. the ... feature in Matlab)
Robin Hankin
r.hankin at noc.soton.ac.uk
Thu Oct 5 09:39:26 CEST 2006
Hi Wee-Jin
you can block out bits of R code with
if(FALSE){
<code not executed>
}
For the line breaking, R deals with incomplete lines by not executing
the statement
until you finish it. In the function case, it waits for you to close
a bracket.
If you type:
myFunc(a=3,
b=5,
c=6,
d=7
)
myFunc() will only execute
when you close the bracket
HTH
rksh
On 5 Oct 2006, at 08:28, Wee-Jin Goh wrote:
> Hello again list,
>
> I thought I'd start a new thread, seeing as it's completely different
> from my previous question. Some functions I have written require many
> parameters, and so do not fit nicely into an 80 column width display.
> This is usually avoided, by spreading that particular statement over
> a few lines. This is something that I do in Matlab with the following:
>
> myFunc( parameter1, ...
> parameter2, ...
> parameter3, ...
> parameter4)
>
> The ... operator in Matlab allows me to spread a statement over
> several lines. The ... operator in R seems to be more like the ...
> operator in C, which allows for a variable argument list.
>
> How do I accomplish this task in R? It's not a show stopper, but it
> would make reading my code much much easier.
>
> Cheers,
> Wee-Jin
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
More information about the R-help
mailing list