...or
if( (x*y) > 0 ){ }
Regards
Lui
On Mon, Jan 24, 2011 at 1:27 PM, Rainer Schuermann
<[email protected]> wrote:
> On Monday, January 24, 2011 07:18:03 pm Alaios wrote:
>> Hello :)
>> I wanted to right an expression to check when x and y have the same sign
>> and I wrote the following:
>>
>> if ((x<0 && y<0) || (x>0 && y>0))
>>
>> which looks pretty ugly to me.
>>
>> Can you please suggest me a better way for that?
>>
>> Regards
>> Alex
>>
>> ______________________________________________
>> [email protected] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
> if( sign( x ) == sign( y ) )
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should
go.