another exercise

Author

Published

March 31, 2026

Interactive session in R: Using the console

Use R like a calculator

you can use r like a calculator

# you can write comments that r won't read as commands

# addition
1 + 2
[1] 3
# Multiplication and Division too of course
1 * 2 + 3 / 3
[1] 3
# And parentheses
1 * (2 + 3) / 3
[1] 1.666667

And exponentials and logs

5 ^ 2
[1] 25
25 ^ .5
[1] 5

Functions are important part of R

sqrt(x = 25)
[1] 5
log10(x = 1000)
[1] 3

Assignment operator to creating objects

# you can assign values to objects; check the global environment!
x <- 1
z <- 2
# you can use these objects
x + 4
[1] 5
# and make new objects
y <- x + 4
y
[1] 5