$cod splitting variable for data of a single year/region. This is not super robust. If you have many regions or whatever then do it yourself. This function was just written to make ggb() robust to the case of a user specifying data that don't have any territorial or other subgroups, aside from sex.addcod(X)data.frame, possibly but not necessarily with column $sex.$cod appended.