I have a dataset containing two columns ("from" & "to") representing interactions between actors. My problem is that each interaction is represented from the perspective of each actor, meaning the pair from A to B is also present as from B to A. Usually, duplicates can be identified and removed via the unique() or distinct() but in this case I did not find a solution. Any suggestions? Here is some of my data:
structure(list(from = c("anti-government protesters", "anti-government protesters",
"human rights organisations", "human rights organisations", "MDCT supporters",
"Movement for Democratic Change", "Movement for Democratic Change",
"Movement for Democratic Change", "Movement for Democratic Change",
"nurses", "nurses", "opposition", "opposition", "opposition",
"opposition supporters", "opposition supporters", "opposition supporters",
"opposition supporters", "opposition supporters", "ordinary citizens",
"ordinary citizens", "youth activists", "youth activists", "youth activists"
), to = c("Movement for Democratic Change", "opposition supporters",
"nurses", "ordinary citizens", "opposition supporters", "anti-government protesters",
"opposition", "opposition supporters", "youth activists", "human rights organisations",
"ordinary citizens", "Movement for Democratic Change", "opposition supporters",
"youth activists", "anti-government protesters", "MDCT supporters",
"Movement for Democratic Change", "opposition", "youth activists",
"human rights organisations", "nurses", "Movement for Democratic Change",
"opposition", "opposition supporters"), n = c(1L, 1L, 1L, 1L,
1L, 1L, 12L, 16L, 12L, 2L, 2L, 5L, 5L, 5L, 1L, 1L, 6L, 3L, 3L,
1L, 1L, 1L, 1L, 1L)), class = c("grouped_df", "tbl_df", "tbl",
"data.frame"), row.names = c(NA, -24L), groups = structure(list(
from = c("anti-government protesters", "anti-government protesters",
"human rights organisations", "human rights organisations",
"MDCT supporters", "Movement for Democratic Change", "Movement for Democratic Change",
"Movement for Democratic Change", "Movement for Democratic Change",
"nurses", "nurses", "opposition", "opposition", "opposition",
"opposition supporters", "opposition supporters", "opposition supporters",
"opposition supporters", "opposition supporters", "ordinary citizens",
"ordinary citizens", "youth activists", "youth activists",
"youth activists"), to = c("Movement for Democratic Change",
"opposition supporters", "nurses", "ordinary citizens", "opposition supporters",
"anti-government protesters", "opposition", "opposition supporters",
"youth activists", "human rights organisations", "ordinary citizens",
"Movement for Democratic Change", "opposition supporters",
"youth activists", "anti-government protesters", "MDCT supporters",
"Movement for Democratic Change", "opposition", "youth activists",
"human rights organisations", "nurses", "Movement for Democratic Change",
"opposition", "opposition supporters"), .rows = structure(list(
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -24L), .drop = TRUE))