switch seq_len(length(foo)) to seq_along(foo)