Source: University of Auckland, R Project
Source: Twitter
Extra: More on historical R release names
.R
extension and contains a collection of valid R commands..md
file extension..Rmd
file extension_
or *
for emphasis (single - italic, double - bold, triple - bold and italic)*one*
becomes one, __two__
- two and ***three***
- three#
, ##
, ###
, ####
and so on-
, +
or *
1.
(counter is auto-incremented)[some text here](url_here)
![alt text](url or path to image)
Some text in *italic* and **bold**
Simple list:
- A
- B
Ordered list:
1. A
1. B
Example, where $Y = X + 5$
```{r}
x <- 3
y <- x + 5
y
```
Some text in italic and bold
Simple list:
Ordered list:
Example, where $Y = X + 5$
{r}
x <- 3
y <- x + 5
y
print("Hello World!")
[1] "Hello World!"
Key operators (infix functions) in R are:
+
, -
, *
, ^
, /
, %/%
, %%
, %*%
) &
, &&
, |
, ||
, !
)==
, !=
, >
, >=
, <
, <=
)<-
, <<-
, =
)%in%
)1 + 1
[1] 2
5 - 3
[1] 2
6 / 2
[1] 3
4 * 4
[1] 16
## Exponentiation, note that 2 ** 4 also works, but is not recommended
2 ^ 4
[1] 16
# Integer division
7 %/% 3
[1] 2
# Modulo operation (remainder of division)
7 %% 3
[1] 1
3 != 1 # Not equal
[1] TRUE
3 > 3 # Greater than
[1] FALSE
FALSE | TRUE # True if either first or second operand is True, False otherwise
[1] TRUE
F | T # R also treats F and T as Boolean, but it is not recommended due to poor legibility
[1] TRUE
3 > 3 | 3 >= 3 # Combining 3 Boolean expressions
[1] TRUE