move helper functions to .Rprofile