How to calculate factorials in R with factorial(), gamma(x+1), prod() and cumprod(), plus the NaN and zero cases, all checked against the R manual. One disambiguation: the “factorial” in a factorial ...