goto to direct to specific line

How to use goto statement in R?

like direct any condition to any line in R.

R doesn't have goto, but there is a discussion of alternatives in the thread below:

From Peter Daalgard's response:

It doesn't exist, but it can always be replaced by if() {} else {}
constructs. (You don't usually see goto in the class of "functional
programming languages" to which R belongs. See also
Edsger W. Dijkstra - Wikipedia .)

R does have break, next, and return() which cover some common cases
where goto might be used with some reason.

I recommend looking directly at the thread, though, as there's more detailed discussion.


@mara Thankyou for the information.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.