Source: http://iml.univ-mrs.fr/~reboul/R-cours%207.pdf