'How to perform cube root transformation in given dataframe in R

I already have a dataframe that needed to import from desktop. I first read file and then perform cube root transformation, but it told me wrong when I do the transformation. What is the problem? The dataframe include word and number.

# Import data frame
df <- read.csv("C:/Users/yinc1/Desktop/test_R.csv", header = TRUE)
head(df)


# Perform cube root transformation 
df_cube_root <- df^(1/3)

enter image description here

r


Solution 1:[1]

I believe you need to reference the specific column of the data you wish to transform.

For example, for column y of df:

df_cube_root <- df$y^(1/3)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gui