-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't working
Description
If there is any same-sex couple getting married via the cohabitation route then the following checkmate command will raise a 'unique integer' error since the ids of those individuals will appear twice in both vector ids.
One way to fix this would be to call unique on the id vectors, only if the duplicated ids belong to individuals in a same-sex partnership.
#' Check to make sure that the duplicated ids come from same-sex cohabiting
#' individuals to get married.
if (length(unique(cohabiting_person_to_marry_ids)) !=
length(cohabiting_person_to_marry_ids)) {
tab <- table(cohabiting_person_to_marry_ids)
if (any(tab > 2)) {
stop("There are some ids that appear more than twice. Please debug or report this.")
}
potential_same_sex_ind_ids <- as.integer(names(tab[tab != 1]))
#' pssind = potential_same_sex_ind
pssind_sex <- Ind$get_attr("sex", ids = potential_same_sex_ind_ids)
pssind_partner_ids <- Ind$get_attr("partner_id", ids = potential_same_sex_ind_ids)
pssind_partner_sex <- Ind$get_attr("sex", ids = pssind_partner_ids)
if (all(pssind_sex == pssind_partner_sex)) {
stop("There are duplicated ids of opposite couples in the marriage from cohabitation process.")
} else {
cohabiting_person_to_marry_ids <- unique(cohabiting_person_to_marry_ids)
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working