Compute the Natural Logarithm of the Absolute Value of Gamma Function in R Programming – lgamma() Function Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report lgamma() function in R Language is used to compute the natural logarithm of the absolute gamma value of a numeric vector computed using the gamma function. lgamma function is basically, lgamma(x) = ln(factorial(x - 1)) Syntax: lgamma(x) Parameters: x: Non-negative Numeric Vector Example 1: # R program to calculate the # natural logarithm of gamma value # Calling lgamma Function lgamma(2) lgamma(3) lgamma(5) Output: [1] 0 [1] 0.6931472 [1] 3.178054 Example 2: # R program to calculate the lgamma value # Creating vectors x1 <- c(2, 3, 5) x2 <- c(6, 7, 8) x3 <- c(-1, -2, -3) # Calling lgamma() Function lgamma(x1) lgamma(x2) lgamma(x3) Output: [1] 0.0000000 0.6931472 3.1780538 [1] 4.787492 6.579251 8.525161 [1] Inf Inf Inf Warning messages: 1: value out of range in 'lgamma' 2: value out of range in 'lgamma' 3: value out of range in 'lgamma' Here, in the above code, the NaN is produced for a Negative numeric vector. Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now! Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore. Last Updated : 12 Jun, 2020 Like Article Save Article Previous Compute the cosine value which is multiples of pi in R Programming - cospi() Function Next Compute the Logarithmic Derivative of the gamma Function in R Programming - digamma() Function Share your thoughts in the comments Add Your Comment Please Login to comment...