I am trying to remove duplicated rows in my data frame, but either distinct(d)
or filter(duplicated(d))
does not remove the duplicated rows (where d
is the data frame name with duplicated rows) -- the functions do not recognize the duplicated rows. Is there any common reason why this happens?
Below is the example dataset using dput
.
structure(list(id.case = c("114746", "114746", "114746", "114746",
"114746", "114746", "114746", "114746", "114746", "114746", "114746",
"114746", "114746", "114746", "114746", "114746", "114746", "114746",
"114746", "114746"), id.pair = c("78272-10794", "9330-10794",
"9330-10794", "80739-42071", "80739-42071", "42114-10794", "42114-10794",
"84701-42114", "84701-42114", "5533-42071", "5533-42071", "8876-5533",
"8876-5533", "5652-42114", "5652-42114", "8920-5652", "8920-5652",
"78272-5533", "78272-5533", "9114-78272"), e1.conditional.dyad = c(1.07224025692901,
0.568380969299369, 0.568380969302098, 0.252545406662165, 0.252545406663273,
-1.21808723071715, -1.21808723071797, -4.1477891182987, -4.14778911829956,
-1.48315629665277, -1.48315629665359, -1.3047217588809, -1.30472175888309,
-1.63547814316539, -1.63547814316453, -0.671008645771849, -0.671008645772957,
-0.0801843233972761, -0.0801843233964519, 2.30874742062369)), row.names = c(NA,
20L), class = "data.frame")
I am trying to use the below code.
d %>% distinct