[R] R: to the power
allan_sta_staff_sci_main_uct@mail.uct.ac.za
allan_sta_staff_sci_main_uct at mail.uct.ac.za
Tue Jul 12 15:11:32 CEST 2005
hi all
why does R do this:
(-8)^(1/3)=NaN
the answer should be : -2
a silly question but i kept on getting errors in some of my code due to this
problem.
i solve the problem as follows:
say we want : (-a)^(1/3)
then : sign(a)*(a^(1/3)) works
but there has to be a simpler way of soing such a simple mathematical operation.
thanking you
/
allan
More information about the R-help
mailing list