gamma() function in R Language is used to compute the gamma value of a numeric vector using the gamma function.
Gamma function is basically,
gamma(x) = factorial(x - 1)
x: Non-negative Numeric Vector
 1  2  24
 1 2 24  120 720 5040  NaN NaN NaN Warning message: In gamma(x3) : NaNs produced
Here, in the above code, the NaN is produced for a Negative numeric vector.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.