R functions for robust statistics