mg14's favourite R functions