Exponential of the column in R

Exponential value of the column in R is calculated using exp()  function. Let’s see how to calculate exponential of a column in R with example

First let’s create the dataframe

df1 = data.frame( Name = c('George','Andrea', 'Micheal','Maggie','Ravi','Xien','Jalpa'), 
                  Grade_score=c(4,6,2,9,5,7,8),
                  Mathematics1_score=c(45,78,44,89,66,49,72),
                  Science_score=c(56,52,45,88,33,90,47))

df1 will be

Exponential of the column in R 1

 

Exponential value of the column in R

Exponential of the column Grade_score is calculated using exp() function as shown below.

df1$Exp_score = exp(df1$Grade_score)
df1

So the resultant dataframe will be

Exponential of the column in R 2

 

                                                                                                           

Author

  • Sridhar Venkatachalam

    With close to 10 years on Experience in data science and machine learning Have extensively worked on programming languages like R, Python (Pandas), SAS, Pyspark.

    View all posts