R
1 + 100

R
> 1 +

R
3 + 5 * 2

R
(3 + 5) * 2

R
(3 + (5 * (2 ^ 2))) # hard to read
  3 + 5 * 2 ^ 2       # clear, if you remember the rules
  3 + 5 * (2 ^ 2)     # if you forget some rules, this might help

R
2/10000

R
5e3  # Note the lack of minus here

R
getwd() #returns an absolute filepath

R
sin(1)  # trigonometry functions

R
log(1)  # natural logarithm

R
log10(10) # base-10 logarithm

R
exp(0.5) # e^(1/2)

R
1 == 1  # equality (note two equals signs, read as "is equal to")

R
1 != 2  # inequality (read as "is not equal to")

R
1 < 2  # less than

R
1 <= 1  # less than or equal to

R
1 > 0  # greater than

R
1 >= -9 # greater than or equal to

R
x <- 1/40

R
x

R
log(x)

R
x <- 100

R
x <- x + 1 #notice how RStudio updates its description of x on the top right tab
 y <- x * 2

R
x = 1/40

R
min_height
 max.height
 _age
 .mass
 MaxLength
 min-length
 2widths
 celsius2kelvin

R
min_height
 max.height
 MaxLength
 celsius2kelvin

R
.mass

R
_age
min-length
2widths

R
1:5

R
2^(1:5)

R
x <- 1:5
2^x

R
ls()

R
ls

R
x

R
rm(x)

R
rm(list = ls())

R
rm(list <- ls())


Source: The Carpentries, https://swcarpentry.github.io/r-novice-gapminder/01-rstudio-intro/index.html
Creative Commons License This work is licensed under a Creative Commons Attribution 4.0 License.

Last modified: Thursday, 15 December 2022, 4:45 PM