samedi 24 mars 2018

If same value exists in list add it into the new variable

I have a list like this

month     year  id
1.        2014. 20.
1.        2014. 305.
1.        2014. 305.

If number in id column already exist add it into the new variable

month     year  id
1.        2014. 305.
1.        2014. 305.

Im not sure where to start, I think that I should to create if statement, but I don't know what to put inside it.

if(duplicated(my_data$id) = TRUE) {

}

Aucun commentaire:

Enregistrer un commentaire