3 of 3
added 472 characters in body

Compare value in the same column in R

I want to compare the values in the same column in R. My data set is like :

F1 F2 F3
C300100 M1001 abc
C300100 M1002 abc,def
C300100 M1003 abc,def,ghi
C300101 M1004 q
C300101 M1005 q,r
C300101 M1006 q,r,s
C300101 M1007 a,b,c,d
C30010111 C300101 abc
C30010111 C300101 def,khy
C30010199 cc c23

The expected output is :

F1 F2 F3 F4 C300100 M1001 abc TRUE
C300100 M1002 abc,def TRUE
C300100 M1003 abc,def,ghi TRUE
C300101 M1004 q TRUE
C300101 M1005 q,r TRUE
C300101 M1006 q,r,s TRUE
C300101 M1007 a,b,c,d FALSE
C30010111 M1008 abc FALSE C30010111 C300101 def,khy FALSE
C30010199 cc c23 FALSE

In the first case of F1= A and F2 = 100, because F3=g is present in second record and third record so it is true.

For the second record A 100 g,h g and h is present in record 3 so it is true.

I need to compare first record with second and third and so on, then second record with third and so on. If value is present is subsequent record then it is TRUE otherwise it is FALSE.

is there a library and function which does this efficiently.

Any help is highly appreciated.

Regards, A