e in R

Euler’s number, also known as Napier’s constant, is an important mathematical constant that appears in many different contexts in mathematics and physics. In R programming, the constant is represented by the letter “e”. Its value is approximately equal to 2.71828. The exp() function calculates the Euler’s number in R. In this guide, we will explain how to compute e in R.

exp() Function to Calculate the e in R

The exp() function can also be used as an abbreviation for “exponential.” It takes a value and raises it to the power of e. This function works because it has a base of e.

Syntax

exp(n)

Argument

  • n = a numeric vector

Example

#Euler’s number
exp(1)
#Euler’s number to the power of 2
exp(2)

Output

[1] 2.718282
[1] 7.389056

Leave a Comment