I have a data.frame with two columns: Name and Index and 2 million rows.

I am sure that all index were written correctly, but I need to verify the 'Name' column.

How do I do to change all Name values based on Index values.

Let me give an example. Suppose we have the following data.frame 'db':

```
db
Index Name
1      Carlos
2      John
3      Bill
4      Mary
1      Cerlas

```

As it is shown, 'Name' should be equal for every Index value, but someone write it incorrectly.

How would I correct it? Is there a solution employing 'dplyr' or 'tidyr'? 

I tried the following code, but it has not worked.

```
for (i in unique(db$Index)) {
    db$Nome[db$Index==i] <- db$Nome[db$Index==i][1]
}

```

Thanks