I have a dataset & want to remove duplicate values from it

I have written the code in R.
Actually, I want to remove the duplicates in orin column based on approver user_id & creator user_id column
With condition
If the Orin column has a duplicate & approver user_id= " RMS " Or if approver user_id != creator user_id I want to remove that duplicate Orin .

Can anyone please help me with the code?

This was what I came up with but it’s not working as expected. & I am unable to combine Distinct with any other conditions

data = “MOA TRAIL WB.csv”

ReadData = read.csv(data, colClasses = “character”)

df <- ReadData[!duplicated(ReadData$ORIN[which((ReadData$APPROVER_USER_ID == “RMS”) | (ReadData$CREATE_USER_ID!=ReadData$APPROVER_USER_ID))]),]

write.csv(df, file = “C:\Documents\Trail4.csv”)

© Copyright 2013-2020 Analytics Vidhya