J. Mini
J. Mini

Reputation: 1622

What was a For loop? Why isn't it needed in R?

In the R FAQ's section about comparing S and R, we find the following:

In R, For() loops are not necessary and hence not supported.

What was a For() loop and why does R not need it?

Upvotes: 2

Views: 56

Answers (1)

dcarlson
dcarlson

Reputation: 11076

There is a copy of S-PLUS: Programmer’s Guide online. Pages 647-648 contrast for and For loops. The S-Plus manual generally discourages using for loops (pp. 120, 639-641) and encourages apply family approaches, but R has optimized for loops to the point that those recommendations are now moot and the "optimized" For loop is no longer necessary.

Upvotes: 2

Related Questions