I have below mentioned datafram:
df <- read.table(text =
"code Num mail identifier U_id
YY-12 12345 jjf@gmail.com ar145j U-111
YY-13 12345 jjf@gmail.com Ra145J U-111
YY-14 48654 ert@gmail.com at188R U-112
YY-15 48654 Ert@gmail.com At819R U-113
YY-16 88994 fty@ymail.com fr789U U-114
YY-17 88994 fty@ymail.com Rf789X U-115
YY-18 14500 foi@ymail.com xr747Y U-116
YY-19 14500 foi@ymail.com xY747C U-117", header = T)
Utilizing the above mentioned dataframe, I want to get subset of those rows where for the same Num
and mail
, we have different identifier with consecutive 2 digits difference.
For example in the below mentioned output, identifier ar145j
changed to Ra145J
.
Required Output:
code Num mail identifier U_id
YY-12 12345 jjf@gmail.com ar145j U-111
YY-13 12345 jjf@gmail.com Ra145J U-111
YY-14 48654 ert@gmail.com at188R U-112
YY-15 48654 Ert@gmail.com At819R U-113