gusl: (Default)
[personal profile] gusl
In R, you loop over your list l as follows

for (i in 1:length(l))

But if length(l) is zero, you still visit the loop twice... I do not know an elegant solution to this.

Another one has to do with operator precedence, 1:k+3 gets parsed as (1:k)+3 rather than 1:(k+3).

(no subject)

Date: 2010-02-27 12:51 am (UTC)
From: (Anonymous)
solution: for (i in seq_along(l))

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags