Cube root of the column in R

Cube root of the column in R is calculated using ‘^’ operator. Let’s see how to calculate cube root 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

cube root of the column in R 1

 

Cube root of the column in R

Cube root of the column Grade_score is calculated using ^() function as shown below.

## Cube root of the column in R

df1$cube_root ='^'(df1$Grade_score,1/3)
df1

So the resultant dataframe will be

cube root of the column in R 2

 

Cube root of the column in R - image previous-small-11-1 on http://www.datasciencemadesimple.com                                                                                                                Cube root of the column in R - image next_small-11-1 on http://www.datasciencemadesimple.com