a package version of my R utility functions