actor_merger: added mult='first' to metadata join for parties_actors to deal with duplicate partyIds (see 50Plus, Conservatives and Labour)

master
Your Name 4 years ago
parent 1c14646e8f
commit 771145faf7

@ -160,7 +160,7 @@ actor_merger <- function(df, actors_meta, actor_groups = NULL) {
actor.first = first(sentence_id), actor.first = first(sentence_id),
actor.occ = .N actor.occ = .N
), by = c('id','ids')] ), by = c('id','ids')]
parties_actors <- actors_meta[parties_actors, on = c('ids')][!is.na(id),.(ids = str_c(ids,"_mfsa"), (.SD)), .SDcols = -c('ids')] parties_actors <- actors_meta[parties_actors, on = c('ids'), mult = 'first'][!is.na(id),.(ids = str_c(ids,"_mfsa"), (.SD)), .SDcols = -c('ids')]
## Generate party aggregations (mfs) ## Generate party aggregations (mfs)
parties <- df[str_ends(ids,'_f') | str_ends(ids,'_s'),.( parties <- df[str_ends(ids,'_f') | str_ends(ids,'_s'),.(

Loading…
Cancel
Save