[R] R-SCRIPT Label Calling Method

R. Michael Weylandt michael.weylandt at gmail.com
Tue Jun 12 17:13:02 CEST 2012


Short answer: no.

Long answer: use a closure if for some bizarre reason you just can't
use a loop.

Bonus tip: change the last three lines to:

d <- c > 5

for speed and clarity!

Michael

On Tue, Jun 12, 2012 at 9:25 AM, Rantony <antony.akkara at ge.com> wrote:
> Hi,
>
> here i have some code...
>
>
> a <-1
> b <- b+1
> c <- b+a/20
> if c >5
> { d<- 1 }
> else {  d<- 0  }
>
> i want to repeat this code from the 2nd line [b <- b+1] without using loop.
> Actulay i want to use  "*Label *" and call *GoTo* method like in other
> coding Languages.
> For eg:- like this,
>
>                           a <-1
> *LabelBegin :*
>                           b <- b+1
>                           c <- b+a/20
>                           if c >5
>                                      { d<- 1 }
>                           else {  d<- 0  }
>                          *Go to LabelBegin*
>
> Is there any method like that in R-Script ? Could you please help me fast, i
> have an urgent requirement.
>
> - Thanks
> Antony
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/R-SCRIPT-Label-Calling-Method-tp4633108.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



More information about the R-help mailing list