Open In App

Compute the Natural Logarithm of Factorial in R Programming - lfactorial() Function

Last Updated : 10 Jun, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
lfactorial() function in R Language is used to compute the natural logarithm of factorial of x i.e, ln(x!).
Syntax: lfactorial(x) Parameters: x: positive numeric value
Example 1: Python3
# R program to illustrate
# lfactorial function

# Calling the lfactorial() function
lfactorial(0)
lfactorial(1)
lfactorial(5)
Output:
[1] 0
[1] 0
[1] 4.787492
Example 2: Python3
# R program to illustrate
# lfactorial function

# Calling the lfactorial() function
lfactorial(-4)
Output:
[1] Inf
Warning message:
In lfactorial(-4) : value out of range in 'lgamma'

Next Article
Article Tags :

Similar Reads