Consider the following dataframe:
Gene <- c("PNKD;TMBIM1", "PNKD", "PKHD1", "PKHD1", "SCN1A", "RBMX", "RBMX", "MUC4", "CASKIN;TRAF7", "CASKIN", "LIFR")
Score <- c(0.9, 0.2, 0.5, 0.6, 0.1, 0.985, 0.238, 0.65, 0.9, 0.66, 0.6)
df <- data.frame(Gene, Score)
df
I would like to select the rows in this dataframe in column "Gene" that contain the same string. I would like the following output:
Gene <- c("PNKD;TMBIM1", "PNKD", "PKHD1", "PKHD1", "RBMX", "RBMX","CASKIN;TRAF7", "CASKIN")
Score <- c(0.9, 0.2, 0.5, 0.6, 0.985, 0.238, 0.65, 0.9)
df <- data.frame(Gene, Score)
df