What are good examples of when seq_along
will work, but seq
will produce unintended results?
From the documentation of ?seq
we have:
Note that it dispatches on the class of the first argument irrespective of argument names. This can have unintended consequences if it is called with just one argument intending this to be taken as
along.with
: it is much better to useseq_along
in that case.
sample()
then or just useas.numeric(sample(as.character(c)))
? – Underprivileged