[R] Odp: ^ operator

2009-11-16 Thread Petr PIKAL
Hi AFAIK, this is issue of the preference of operators. r-help-boun...@r-project.org napsal dne 16.11.2009 11:24:59: Hi, I want to apply ^ operator to a vector but it is applied to some of the elements correctly and to some others, it generates NaN. Why is it not able to calculate

Re: [R] Odp: ^ operator

2009-11-16 Thread carol white
but with complex, I get complex numbers for the first and last elements: (as.complex(tmp))^(1/3) [1] 0.01969170+0.03410703i 0.03478442+0.i 0.03285672+0.i [4] 0.08950802+0.i 0.05848363+0.10129661i whereas for the first element, we get the followings. Moreover,

Re: [R] Odp: ^ operator

2009-11-16 Thread Ted Harding
On 16-Nov-09 11:40:29, Petr PIKAL wrote: Hi AFAIK, this is issue of the preference of operators. r-help-boun...@r-project.org napsal dne 16.11.2009 11:24:59: Not in this case (see below), though of course in general - takes precedence over ^, so, for example, in the expression

Re: [R] Odp: ^ operator

2009-11-16 Thread Liviu Andronic
On 11/16/09, Ted Harding ted.hard...@manchester.ac.uk wrote: Not in this case (see below), though of course in general - takes precedence over ^, so, for example, in the expression -2^(1/3) the - is applied first, giving (-2); and then ^ is applied next, giving (-2)^(1/3). There is a

Re: [R] Odp: ^ operator

2009-11-16 Thread Alain Guillet
Hi, You forgot to put the parenthesis in the way Petr told you : (-6.108576e-05)^(1/3) and the result is NaN. What do you want to preserve? Alain carol white wrote: but with complex, I get complex numbers for the first and last elements: (as.complex(tmp))^(1/3) [1]

Re: [R] Odp: ^ operator

2009-11-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.11.2009 13:27:03: but with complex, I get complex numbers for the first and last elements: (as.complex(tmp))^(1/3) [1] 0.01969170+0.03410703i 0.03478442+0.i 0.03285672+0.i [4] 0.08950802+0.i 0.05848363+0.10129661i And

Re: [R] Odp: ^ operator

2009-11-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.11.2009 13:55:30: On 16-Nov-09 11:40:29, Petr PIKAL wrote: Hi AFAIK, this is issue of the preference of operators. r-help-boun...@r-project.org napsal dne 16.11.2009 11:24:59: Not in this case (see below), though of course in

Re: [R] Odp: ^ operator

2009-11-16 Thread Ted Harding
On 16-Nov-09 13:13:27, Liviu Andronic wrote: On 11/16/09, Ted Harding ted.hard...@manchester.ac.uk wrote: Not in this case (see below), though of course in general - takes precedence over ^, so, for example, in the expression -2^(1/3) the - is applied first, giving (-2); and then ^ is