R loop that adds following numbers to each element in list


I would like to create a loop that adds the following two numbers to each element in the list. This means that from a list with a random sequence of number like:

z [1] 70 2 14 107 50 90 15 44 77 97 64

This loop would create

z [1] 70 71 72 2 3 4 14 15 16 107 108 109 110 50 51 52 90 91 92 15 16 17 44 45 46 77 78 79 97 98 99 64 65 66

Sorry for my bad example and thank you in advance for your help. Feel free to ask further questions.

Leave a Comment