R Tip: Use seq_len() to Avoid The Backwards Sequence Bug
Win-Vector Blog 2018-02-19
Summary:
Another R tip. Use seq_len() to avoid The backwards seqeunce bug. Many R users use the “colon sequence” notation to build sequences. For example: for(i in 1:5) { print(paste(i, i*i)) } #> [1] "1 1" #> [1] "2 4" #> [1] "3 9" #> [1] "4 16" However, the colon notation can be unsafe as … Continue reading R Tip: Use
seq_len()
to Avoid The Backwards Sequence Bug