Cubed root function in R (gep3Rt)
  • The cubed root function generated by GeneXproTools is producing the following error in R:

    Warning messages:
    1: In if (x < 0) (-((-x)^(1/3))) else (x^(1/3)) :
    the condition has length > 1 and only the first element will be used

    The function returns NAs so I have substituted it for an alternative:

    gep3Rt <- function(x) {
    sign(x) * abs(x)^(1/3)
    }

    This
    works, but I am wondering if it's causing incorrect predicted values to
    be produced when the R script of the GEP (model) is run (see earlier post: "Using the GEP model in R")

    Any ideas would be appreciated. 
  • Hi,

    I cannot duplicate the warning you get (I'm using version 2.14 of R). Both GeneXproTools implementation and yours return the same values without any warning. Either way if you prefer your implementation you can replace it in the R grammar of GeneXproTools.
  • I'm using the most current version R-3.0.3 with R studio and have tried it on 2 machines now and am getting the same warning. I also tried opening a new script, importing the data, writing the functions and executing the script. When I use the GeneXproTools function and script, I get the error:

    Warning message:
    In if (x < 0) (-((-x)^(1/3))) else (x^(1/3)) :
    the condition has length > 1 and only the first element will be used

    This returns a value for Record ID #1 of 54.15. The modeled value in the GeneXproTools results panel is 46.78. While this returns a value, for other models, NAs are returned. In each case the modeled value is not correct.

    As per previous post, manually transcribing the equation to excel works and returns the 'correct' value.

    When I use my function and the generated R script there is no error message but the returned value remains as 54.15.
  • See the comment to your other post Using the GEP Model in R.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Tagged