Thursday, January 5, 2012

Operators in R, logical and arithmetic

I keep forgetting how to code 'greater than or equal to' and 'smaller than or equal to' in R. Maybe this post will help me to remember forever (probably not)!
& and| or(evaluate every element, and return a value for every element)

&& and

|| or (evaluate left to right, examining only the first element of each vector)
== is equal to
!= is not equal to

< is smaller than
> is greater than


<= is smaller than, or equal to

>= is greater than, or equal to

+ add

- subtract


* multiply

/ divide

^ or ** exponentiation (raise to power)

sqrt() what do you think?

x%%y modulo (what remains when x is divided by y?)

x%/%y modulo division (how many times can x be divided by y?)

No comments:

Post a Comment