4.4 Working in the Console
The console is an interactive environment for Open RStudio, click on the “Console” pane, type 3 + 3
and press enter.
R displays the result of the calculation.
3 + 3
## [1] 6
+
is called an operator. R has the operators you would expect for for
basic mathematics:
Arithmetic operators
operator | meaning |
---|---|
+ | plus |
- | minus |
* | times |
/ | divided by |
^ | exponent |
Logical Operators
operator | meaning |
---|---|
== | exactly equal |
!= | not equal to |
< | less than |
<= | less than or equal to |
> | greater than |
>= | greater than or equal to |
x|y | x or y |
x&y | x and y |
!x | not x |
Spaces can be used to make code easier to read.
2 * 2 == 4
## [1] TRUE