Basic utility functions in R.