Math Functions
sqrt, abs, round, floor, ceiling, exp, log and trig work on vectors.
Example
x <- c(4, 9, 16)
print(sqrt(x))
print(round(3.14159, 2))
print(floor(2.7), ceiling(2.1))
print(abs(-3:3))
print(exp(1)); print(log(100, base = 10))Exercise
Round to 2 places.
(x, 2)Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.