I\'m trying to see if there is a function to directly get the real cube root of a negative number. For example, in Java, there is the Math.cbrt() function. I\'m
Sounds like you just need to define your own Math.cbrt() function.
That will turn performing the operation from something inelegant and cumbersome to something clean, expressive, and easy to apply:
Math.cbrt <- function(x) {
sign(x) * abs(x)^(1/3)
}
x <- c(-1, -8, -27, -64)
Math.cbrt(x)
# [1] -1 -2 -3 -4