# define vector with T/F value for each household
test := sapply(1:length(household_id), function(i){
  hhid <- household_id[i]
  all(1:members[i] %in% persons$person_id[persons$household_id == hhid])
})
# rule must hold for all households
all(test==TRUE)

