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



1 Answer

+1 vote
by (157k 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