从相同的日期和位置创建边缘列表

create an edgelist from same date & location

我想根据包含演员、日期和位置的数据创建边缘列表。我的假设是,当不同的演员在同一时间同一地点出现时,就会存在联系。边缘列表具有“从”(actor1)“到”(actor2) 结构。

这是我的数据,请问如何进行?

structure(list(id = c(6040L, 5999L, 5997L, 5997L, 6238L, 8233L, 
6956L, 6957L, 6034L, 6030L, 5967L, 5993L, 6168L, 6037L, 6032L, 
6024L, 6022L, 6026L, 6172L, 6169L, 6038L, 6203L, 6236L, 6801L, 
6801L, 6870L, 6911L, 6912L, 6914L, 6915L, 6974L, 6968L, 6970L, 
7148L, 7282L, 7280L, 7281L, 281L, 307L, 278L, 309L, 313L, 455L, 
465L, 466L, 495L, 523L, 48L, 48L, 49L, 49L, 54L, 56L, 55L, 53L, 
58L, 57L, 65L, 64L, 66L, 81L, 80L, 82L, 88L, 129L, 127L, 125L, 
123L, 130L, 130L, 130L, 131L, 118L, 118L, 118L, 120L, 121L, 122L, 
122L, 126L, 132L, 458L, 79L, 79L, 457L, 5976L, 5977L, 5975L, 
5983L, 5994L, 6031L, 6167L, 6023L, 6025L, 6237L, 280L, 78L, 78L, 
77L, 76L, 119L, 128L, 124L, 5996L, 461L, 6954L, 6955L, 6955L, 
6953L, 6951L, 270L, 5995L), cowcode = c(552L, 552L, 552L, 552L, 
552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 
552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 
552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 
552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 
552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 
552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 
552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 
552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 
552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 
552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L, 552L), location = c(879233L, 
882229L, 882229L, 882229L, 884979L, 886763L, 887854L, 887854L, 
890189L, 890189L, 890299L, 890299L, 890299L, 890299L, 890299L, 
890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 
890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 
890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 
890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 
890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 
890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 
890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 
890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 
890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 890299L, 
890299L, 890299L, 890299L, 890422L, 890422L, 890422L, 893697L, 
894701L, 894701L, 894701L, 894701L, 894701L, 894701L, 894701L, 
894701L, 894701L, 894701L, 894701L, 894701L, 894701L, 894701L, 
894701L, 894701L, 894701L, 894701L, 895061L, 895061L, 895269L, 
895269L, 895269L, 895269L, 895269L, 1106542L, 7453772L), latitude = c(-17.83028, 
-17.85472, -17.85472, -17.85472, -18.9707, -20.06373, -18.30404, 
-18.30404, -17.88547, -17.88547, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -17.82772, -17.82772, -17.82772, -17.82772, 
-17.82772, -17.82772, -19.45, -19.45, -19.45, -17.36667, -20.15, 
-20.15, -20.15, -20.15, -20.15, -20.15, -20.15, -20.15, -20.15, 
-20.15, -20.15, -20.15, -20.15, -20.15, -20.15, -20.15, -20.15, 
-20.15, -17.30192, -17.30192, -22.21667, -22.21667, -22.21667, 
-22.21667, -22.21667, -18.01274, -19.50077), longitude = c(30.98222, 
30.99, 30.99, 30.99, 32.67086, 30.82766, 31.19832, 31.19832, 
30.9927, 30.9927, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 
31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 
31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 
31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 
31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 
31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 
31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 
31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 
31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 
31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 31.05337, 
31.05337, 31.05337, 31.05337, 29.81667, 29.81667, 29.81667, 30.2, 
28.58333, 28.58333, 28.58333, 28.58333, 28.58333, 28.58333, 28.58333, 
28.58333, 28.58333, 28.58333, 28.58333, 28.58333, 28.58333, 28.58333, 
28.58333, 28.58333, 28.58333, 28.58333, 31.33056, 31.33056, 30, 
30, 30, 30, 30, 31.07555, 31.63936), asciiname = c("Warren Park", 
"Rugare", "Rugare", "Rugare", "Mutare", "Masvingo", "Mahusekwa", 
"Mahusekwa", "Highfield", "Highfield", "Harare", "Harare", "Harare", 
"Harare", "Harare", "Harare", "Harare", "Harare", "Harare", "Harare", 
"Harare", "Harare", "Harare", "Harare", "Harare", "Harare", "Harare", 
"Harare", "Harare", "Harare", "Harare", "Harare", "Harare", "Harare", 
"Harare", "Harare", "Harare", "Harare", "Harare", "Harare", "Harare", 
"Harare", "Harare", "Harare", "Harare", "Harare", "Harare", "Harare", 
"Harare", "Harare", "Harare", "Harare", "Harare", "Harare", "Harare", 
"Harare", "Harare", "Harare", "Harare", "Harare", "Harare", "Harare", 
"Harare", "Harare", "Harare", "Harare", "Harare", "Harare", "Harare", 
"Harare", "Harare", "Harare", "Harare", "Harare", "Harare", "Harare", 
"Harare", "Harare", "Harare", "Harare", "Harare", "Gweru", "Gweru", 
"Gweru", "Chinhoyi", "Bulawayo", "Bulawayo", "Bulawayo", "Bulawayo", 
"Bulawayo", "Bulawayo", "Bulawayo", "Bulawayo", "Bulawayo", "Bulawayo", 
"Bulawayo", "Bulawayo", "Bulawayo", "Bulawayo", "Bulawayo", "Bulawayo", 
"Bulawayo", "Bulawayo", "Bindura", "Bindura", "Beitbridge", "Beitbridge", 
"Beitbridge", "Beitbridge", "Beitbridge", "Chitungwiza", "Mutare"
), event_date = c("2003-06-03", "2003-03-18", "2003-03-18", "2003-03-18", 
"2003-11-18", "2010-11-07", "2008-03-09", "2008-03-09", "2003-06-02", 
"2003-06-02", "2003-02-07", "2003-03-18", "2003-06-02", "2003-06-02", 
"2003-06-02", "2003-06-02", "2003-06-02", "2003-06-02", "2003-06-02", 
"2003-06-03", "2003-06-03", "2003-07-08", "2003-11-18", "2006-02-21", 
"2006-02-21", "2007-02-18", "2007-08-29", "2007-08-29", "2007-11-30", 
"2007-11-30", "2008-04-04", "2008-04-04", "2008-04-04", "2008-05-24", 
"2008-06-27", "2008-06-27", "2008-06-28", "2013-07-28", "2013-07-28", 
"2013-07-28", "2013-07-28", "2013-08-12", "2014-09-04", "2014-10-28", 
"2014-10-30", "2015-04-11", "2015-11-19", "2016-02-18", "2016-02-18", 
"2016-02-24", "2016-02-24", "2016-04-14", "2016-04-14", "2016-04-14", 
"2016-04-14", "2016-05-25", "2016-05-25", "2016-07-20", "2016-07-20", 
"2016-07-21", "2016-08-17", "2016-08-17", "2016-08-24", "2016-09-09", 
"2017-11-18", "2017-11-18", "2017-11-18", "2017-11-18", "2017-11-18", 
"2017-11-18", "2017-11-18", "2017-11-18", "2017-11-18", "2017-11-18", 
"2017-11-18", "2017-11-18", "2017-11-18", "2017-11-18", "2017-11-18", 
"2017-11-18", "2017-11-20", "2014-10-07", "2016-08-13", "2016-08-13", 
"2014-10-04", "2003-02-28", "2003-02-28", "2003-02-28", "2003-03-04", 
"2003-03-18", "2003-06-02", "2003-06-02", "2003-06-02", "2003-06-02", 
"2003-11-18", "2013-07-27", "2016-08-06", "2016-08-06", "2016-08-06", 
"2016-08-06", "2017-11-18", "2017-11-18", "2017-11-18", "2003-03-18", 
"2014-10-17", "2008-02-23", "2008-02-23", "2008-02-23", "2008-02-23", 
"2008-02-23", "2013-07-17", "2003-03-18"), side = c(1L, 1L, 1L, 
1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 
1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L), actors = c("opposition supporters", 
"youths", "opposition supporters", "youths", "", "ZANU PF supporters", 
"villagers", "villagers", "opposition supporters", "opposition supporters", 
"Movement for Democratic Change activists", "opposition supporters", 
"opposition protesters", "students", "students", "students", 
"opposition supporters", "opposition protesters", "students", 
"anti-government protesters", "opposition supporters", "supporters of Movement for Democratic Change", 
"", "women", "National Constitutional Assembly members", "opposition party supporters", 
"Zimbabwe War Veterans Association members", "Mugabe supporters", 
"Mugabe supporters", "Mugabe supporters", "war veterans", "war veterans", 
"guerrilla war veterans", "Mugabe supporters", "Mugabe supporters", 
"Mugabe supporters", "Mugabe supporters", "ZANU PF party supporters", 
"ZANU PF party supporters", "ZANU PF party supporters", "ZANU PF party supporters", 
"ZANU PF party supporters", "supporters of president Mugabe", 
"", "", "Zimbabwe Congress of Trade Unions", "ruling party supporters", 
"war veterans", "youth activists", "youth", "opposition", "opposition", 
"opposition Movement for Democratic change", "supporters of Movement for Democratic Change", 
"supporters of Movement for Democratic Change", "youth league", 
"", "ruling party ZANU PF", "ruling party ZANU PF", "members of ruling party ZANU PF", 
"", "", "supporters of the Movement for Democratic Change", "youth protest movement", 
"military", "", "", "", "military", "veterans", "activists", 
"", "independence war veterans", "ruling party barons", "army", 
"supporter of pastor Evan Mawarire", "army", "veterans", "members of Mugabe's government", 
"", "students", "supporters of ZANU PF party", "members of the Tsvangirai's Movement for Democratic Change", 
"members of Zimbabwe People First", "Grace Mugabe supporters", 
"cricket fans", "cricket fans", "cricket fans", "", "opposition supporters", 
"opposition supporters", "opposition supporters", "opposition supporters", 
"opposition supporters", "", "ZANU PF party supporters", "cricket viewers", 
"graduates", "members of the Woman of Zimbabwe Arise group", 
"cricket viewers", "", "", "", "opposition supporters", "ZANU PF party supporters", 
"Mugabe supporters", "Mugabe supporters", "school children", 
"Mugabe supporters", "Mugabe supporters", "ZANU PF party supporters", 
"opposition supporters"), issue = c("against:Mugabe's repressions", 
"against:Mugabe's government", "against:Mugabe's government", 
"against:Mugabe's government", "against:Mugabe's autocratic rule", 
"for:Mugabe to rule the country", "for:Mugabe", "for:Mugabe", 
"against:Mugabe's government", "against:Mugabe's policies", "against:Mugabe;against:visit of Olusegun Obasanjo", 
"against:Mugabe's government", "against:Mugabe's government", 
"against:Mugabe's government", "against:Mugabe's policies", "for:Mugabe to step down", 
"for:Mugabe to step down", "for:Mugabe to step down", "for:resignation of President Mugabe", 
"against:Mugabe's government", "against:Mugabe's government", 
"for:Mugabe to step down;for:transitional government", "against:Mugabe's autocratic rule", 
"against:Mugabe's birthday celebration", "against:Mugabe's birthday celebration", 
"against:deteriorating living conditions;against:Mugabe to postpone presidential elections", 
"for:Mugabe;against:Western imperialism", "against:western critics;for:Mugabe", 
"for:Mugabe's presidential candidature", "for:Mugabe's presidential candidature", 
"for:Mugabe", "for:Mugabe", "for:Mugabe", "for:open campaign;for:Mugabe as president", 
"for:revolution;for:vote for Mugabe", "for:revolution;for:voting for Mugabe", 
"for:revolution;for:voting for Mugabe", "for:Mugabe campaign", 
"for:Mugabe campaign", "for:Mugabe campaign", "for:Mugabe campaign", 
"for:reelected president Mugabe", "for:Mugabes wife Grace to lead the ruling party's women's wing", 
"for:Mugabe's resignation", "for:Mugabe and his wife", "for:Mugabe to fix ailing economy;for:two million new jobs", 
"for:president Mugabe's next presidential bid", "against:Mugabe's succession", 
"against:Mugabe's succession", "against:Birthday party for Mugabe", 
"against:Birthday party for Mugabe", "against:Mugabe's misrule", 
"against:Mugabe", "against:Mugabe", "against:Mugabe", "for:Mugabe's rule for life", 
"for:Mugabe's rule", "for:Mugabe's rule", "for:Mugabe's rule", 
"for:Mugabe's rule", "against:Mugabe's succession", "against:Mugabe's economy policies", 
"against:Mugabe", "against:police brutality;against:Mugabe", 
"for:Mugabe's resignation", "for:Mugabe's resignation", "for:Mugabe's resignation", 
"for:Mugabe's resignation", "for:Mugabe's resignation", "for:Mugabe's resignation", 
"for:Mugabe's resignation", "for:Mugabe's resignation", "for:Mugabe's resignation", 
"for:Mugabe's resignation", "for:Mugabe's resignation", "for:Mugabe's resignation", 
"for:Mugabe's resignation", "for:Mugabe's resignation", "for:Mugabe's resignation", 
"for:Mugabe's resignation", "for:Mugabe's resignation", "against:party division;for:presidency of Robert Mugabe", 
"against:Mugabe's economy policies", "against:Mugabe's economy policies", 
"against:Western aid;for:presidency of Robert Mugabe", "against:Mugabe;for:justice", 
"against:Mugabe;for:justice", "against:Mugabe;for:justice", "against:Mugabe", 
"against:Mugabe's government", "against:Mugabe's policies", "against:government;against:Mugabe's dictatorial rule", 
"for:Mugabe to step down", "for:Mugabe to step down", "against:Mugabe's autocratic rule", 
"for:Mugabe campaign", "against:Mugabe", "against:Mugabe", "against:Mugabe's economy policies", 
"against:Mugabe's succession", "for:Mugabe's resignation", "for:Mugabe's resignation", 
"for:Mugabe's resignation", "against:Mugabe's government", "against:contenders of Robert Mugabe", 
"against:regime change;for:celebrating Mugabe's birthday", "for:Mugabe's birthday", 
"for:Mugabe's birthday", "for:celebrating Mugabe's birthday;for:kicking off election campaign", 
"for:Mugabe's birthday;for:campaign start", "for:Mugabe campaign", 
"against:Mugabe's government"), scope = c(0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), part_violence = c(NA, 
1L, 1L, 1L, NA, NA, NA, NA, NA, 1L, NA, 1L, NA, NA, NA, NA, NA, 
1L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0L, NA, NA, NA, NA, NA, 
NA, 1L, 1L, 1L, NA, NA, NA, NA, NA, NA, 0L, NA, NA, NA, NA, NA, 
NA, NA, 0L, NA, 0L, NA, NA, 0L, 0L, 0L, NA, NA, NA, 1L, 0L, 0L, 
NA, 0L, 0L, 0L, 0L, 0L, 0L, NA, NA, NA, NA, 1L, NA, NA, 0L, 0L, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1L, NA, NA, NA, NA, NA, NA, 
NA, NA, 0L, 0L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 3L, NA), 
    sec_engagement = c(2L, 2L, 2L, 2L, 2L, NA, NA, NA, 3L, 2L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, NA, 1L, NA, NA, 1L, 1L, 1L, NA, NA, NA, NA, NA, NA, NA, 
    NA, NA, NA, 2L, NA, NA, NA, 2L, 2L, NA, NA, NA, NA, 1L, 1L, 
    NA, 1L, NA, NA, NA, 2L, 2L, 2L, 2L, 1L, NA, 1L, 1L, NA, NA, 
    NA, 1L, NA, NA, NA, NA, NA, NA, NA, 1L, NA, NA, NA, NA, NA, 
    2L, NA, 2L, 2L, NA, 2L, 2L, 2L, 2L, 2L, NA, 1L, 1L, 1L, NA, 
    NA, NA, 1L, NA, NA, NA, NA, NA, NA, NA, NA, NA), numparticipants = c("", 
    "", "", "", "", "300;500", "several thousands", "several thousands", 
    "", "", "20", "", "", "", "", "hundreds", "", "", "", "", 
    "", "30", "200", "", "", "", "5000", "thousands", "thousands", 
    "thousands", "400", "400", "hundreds;400", "", "", "", "", 
    "40000", "40000", "", "30000", "thousands", "hundreds", "", 
    "hundreds", "200", "5000", "", "", "", "", "thousands", "2000", 
    "2000", "2000", "thousands", "30000;60000", "tens of thousands", 
    "thousands", "thousands", "several hundreds", "hundreds", 
    "200", "30", "", "thousands", "thousands", "tens of thousands", 
    "thousands", "thousands", "thousands", "tens of thousands", 
    "10000", "10000", "10000", "", "thousands", "10000", "10000", 
    "thousands", "several hundreds", "", "thousands", "thousands", 
    "hundreds", "", "", "", "", "", "500", "", "", "", "", "", 
    "", "", "", "hundreds", "", "", "", "", "", "", "", "", "", 
    "thousands", "", ""), avg_numparticipants = c(NA, NA, NA, 
    NA, NA, 400L, 2000L, 2000L, NA, NA, 20L, NA, NA, NA, NA, 
    200L, NA, NA, NA, NA, NA, 30L, 200L, NA, NA, NA, 5000L, 2000L, 
    2000L, 2000L, 400L, 400L, 300L, NA, NA, NA, NA, 40000L, 40000L, 
    NA, 30000L, 2000L, 200L, NA, 200L, 200L, 5000L, NA, NA, NA, 
    NA, 2000L, 2000L, 2000L, 2000L, 2000L, 45000L, 15000L, 2000L, 
    2000L, 200L, 200L, 200L, 30L, NA, 2000L, 2000L, 15000L, 2000L, 
    2000L, 2000L, 15000L, 10000L, 10000L, 10000L, NA, 2000L, 
    10000L, 10000L, 2000L, 200L, NA, 2000L, 2000L, 200L, NA, 
    NA, NA, NA, NA, 500L, NA, NA, NA, NA, NA, NA, NA, NA, 200L, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, 2000L, NA, NA), source = c("The Associated Press", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "The Associated Press", 
    "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "The Associated Press", 
    "The Associated Press", "The Associated Press", "The Associated Press", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "The Associated Press", 
    "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "The Associated Press", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "The Associated Press", 
    "The Associated Press", "The Associated Press", "Agence France Presse -- English", 
    "The Associated Press", "The Associated Press", "The Associated Press", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "The Associated Press", "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "Agence France Presse -- English", "The Associated Press", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "The Associated Press", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "The Associated Press", "Agence France Presse -- English", 
    "The Associated Press", "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "Agence France Presse -- English", "The Associated Press", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "The Associated Press", "The Associated Press", "The Associated Press", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "The Associated Press", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "BBC Summary of World Broadcasts", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "The Associated Press", "The Associated Press", "The Associated Press", 
    "The Associated Press", "The Associated Press", "The Associated Press", 
    "The Associated Press", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "The Associated Press", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "Agence France Presse -- English", "Agence France Presse -- English", 
    "BBC Monitoring Africa - Political Supplied by BBC Worldwide Monitoring", 
    "Agence France Presse -- English"), version = c(1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 3L, 2L, 3L, 3L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 2L, 1L, 1L, 1L, 
    1L, 1L, 2L, 1L)), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -112L))

您可以自行加入框架、重命名和删除重复项

  1. data.table
library(data.table)
setDT(dt)

unique(merge(
  dt[, .(id,location,actors,event_date)],
  dt[, .(id,location,actors,event_date)],
  by=c("location", "event_date"), 
  allow.cartesian=TRUE
)[actors.x!=actors.y, .(location,event_date,from=actors.x, to=actors.y)])

输出:

     location event_date                                         from                                           to
  1:   882229 2003-03-18                                       youths                        opposition supporters
  2:   882229 2003-03-18                        opposition supporters                                       youths
  3:   890299 2003-06-02                        opposition protesters                                     students
  4:   890299 2003-06-02                        opposition protesters                        opposition supporters
  5:   890299 2003-06-02                                     students                        opposition protesters
 ---                                                                                                              
106:   894701 2016-08-06                                    graduates members of the Woman of Zimbabwe Arise group
107:   894701 2016-08-06 members of the Woman of Zimbabwe Arise group                              cricket viewers
108:   894701 2016-08-06 members of the Woman of Zimbabwe Arise group                                    graduates
109:   895269 2008-02-23                            Mugabe supporters                              school children
110:   895269 2008-02-23                              school children                            Mugabe supporters
  1. 使用dplyr
inner_join(
  dt %>% select(id, location, actors, event_date),
  dt %>% select(id, location, actors, event_date),
  by = c("location", "event_date")
) %>% 
  filter(actors.x!=actors.y) %>% 
  select(location, event_date, from=actors.x, to=actors.y) %>% 
  distinct()

输出:

     location event_date                                         from                                           to
  1:   882229 2003-03-18                                       youths                        opposition supporters
  2:   882229 2003-03-18                        opposition supporters                                       youths
  3:   890299 2003-06-02                        opposition protesters                                     students
  4:   890299 2003-06-02                        opposition protesters                        opposition supporters
  5:   890299 2003-06-02                                     students                        opposition protesters
 ---                                                                                                              
106:   894701 2016-08-06                                    graduates members of the Woman of Zimbabwe Arise group
107:   894701 2016-08-06 members of the Woman of Zimbabwe Arise group                              cricket viewers
108:   894701 2016-08-06 members of the Woman of Zimbabwe Arise group                                    graduates
109:   895269 2008-02-23                            Mugabe supporters                              school children
110:   895269 2008-02-23                              school children                            Mugabe supporters