Skip to content
Prev 319137 / 398506 Next

Unexpected behavior looping through sequence of dates

R's for loop is only designed to iterato over primitive types. The
help file says of the seq argument:

      seq: An expression evaluating to a vector (including a list and an
           expression) or to a pairlist or ?NULL?.  A factor value will
           be coerced to a character vector.

[This could be more emphatic by stating that any class attributes are
igonred or something of that nature.]

Having for() do anything else would require designing an iteration
protocol -- probably would be nice in principle but not easy to do.

Best,

luke
On Sat, 9 Mar 2013, Peter Ehlers wrote: