I have a vector (specifically with 770 elements) and some of them are repeated. I want all of them to be different. I have developed a code (a simple loop) to sum 0.0000001 when two positions hold the same number so as to make the value slightly different. However, the code doesn't work and I don't know how to correct it. It fails when more than 2 consecutive positions hold the same value.

I am sure it is going to be a fairly simple solution but I can't seem to find it.
The code in in R.

```
for (i in 1:769) {
  if (grid.x[i] == grid.x[i+1]) {
    grid.x[i+1] <- grid.x[i+1] + 0.0000001
  }
}

```