The ln() function in R is “used to calculate the natural log of the input vector”. The default setting of the ln() function is to return the natural logarithm of a value.
ln(x) ln1p() lg() lg1p(x) E lb()
x: It is a numeric or complex vector.
We define ln() and ln1p() as wrappers for log()“ with defaultbase = exp(1) argument and for log1p(), respectively.
The lg1p() is a convenient way to use the optimized code to calculate the logarithm of x + 1 but return the result in the base 10 logarithms.
R does not come with an ln() function but provides a log10() function.
To use the ln() function, use the SciViews package.
library("SciViews") ln(exp(2)) ln1p(c(0, 1, 11, 110)) lg(11 ^ 3) lg1p(c(0, 1, 11, 110)) E ^ 4 lb(1:4)
 2  0.0000000 0.6931472 2.4849066 4.7095302  3.124178  0.000000 0.301030 1.079181 2.045323  54.59815  0.000000 1.000000 1.584963 2.000000
E is the Euler constant and is equal to exp(1).
Krunal Lathiya is a Software Engineer with over eight years of experience. He has developed a strong foundation in computer science principles and a passion for problem-solving. In addition, Krunal has excellent knowledge of Data Science and Machine Learning, and he is an expert in R Language.