actor_aggregation: fixed filenaming of .Rds files

master
Erik de Vries 6 years ago
parent d9f28a46d8
commit 2281d11a68

@ -72,10 +72,13 @@ actor_aggregation <- function(row, actors, es_pwd, localhost, default_operator =
actor <- actors[row,] actor <- actors[row,]
if (actor$`_source.function` == "Party"){ if (actor$`_source.function` == "Party"){
years = seq(2000,2019,1) years = seq(2000,2019,1)
startDate <- '2000'
endDate <- '2019'
} else { } else {
years = c(0) years = c(0)
startDate <- actor$`_source.startDate`
endDate <- actor$`_source.endDate`
} }
if (actor$`_source.function` == 'Party' && actor$party_only == T) { if (actor$`_source.function` == 'Party' && actor$party_only == T) {
actorids <- c(paste0(actor$`_source.partyId`,'_s'), paste0(actor$`_source.partyId`,'_f')) actorids <- c(paste0(actor$`_source.partyId`,'_s'), paste0(actor$`_source.partyId`,'_f'))
} else if (actor$`_source.function` == 'Party') { } else if (actor$`_source.function` == 'Party') {
@ -130,8 +133,7 @@ actor_aggregation <- function(row, actors, es_pwd, localhost, default_operator =
return() return()
} }
} }
saveRDS(bind_rows(lapply(years, actor_aggregator, query, actor, actorids, default_operator, localhost, es_pwd)), file = paste0(actor$`_source.country`,'_',paste0(actorids,collapse = ''),startDate,endDate,'.Rds'))
saveRDS(bind_rows(lapply(years, actor_aggregator, query, actor, actorids, default_operator, localhost, es_pwd)), file = paste0(actor$`_source.country`,'_',paste0(actorids,collapse = ''),'.Rds'))
print(paste0('Done with ',row,'/',nrow(actors),' actors')) print(paste0('Done with ',row,'/',nrow(actors),' actors'))
return() return()
} }

Loading…
Cancel
Save