+4 votes
in Programming Languages by (4.1k points)
I want to create a vector such that the difference between its elements is greater than 1.

E.g.

1,3,5,7,9,11

1 Answer

0 votes
by (31.2k points)

The seq() function can be used to create a vector with any step size in the sequence. The format of the seq() function is as follows:

seq(from, to, step_size)

Here is an example to create a vector with a difference between its elements 2.

> a=seq(1,11,2)
> a
[1]  1  3  5  7  9 11

...