You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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_indpssind_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)
}
}
The text was updated successfully, but these errors were encountered:
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.https://github.com/dymium-org/dymiumModules/blob/d53fdb47680efc9a05e56f0c420c85907e73794e/modules/demography/marriage.R#L75-L80
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.
The text was updated successfully, but these errors were encountered: