Unfortunately, the fact that your question is not reproducible makes it a bit difficult for us to provide any help. We have no information about the count and population datasets or the ageadjust.direct function. Helping you becomes easier if your question is reproducible. Take a look at this if you are not familiar with the term: