Robust R functions