ad r functions