The abs()
function returns the absolute value of a number.
Figure 1 shows a mathematical representation of the abs()
function.
abs(num)
## where num is the number whose absolute value is required
The abs()
function takes a number as a parameter.
The abs()
function returns the absolute value of the number passed as a parameter.
#Positive numbera <- abs(5);print(paste0("abs(5): ", a))#negative numberb <- abs(-5);print(paste0("abs(-5): ", b))#zeroc <- abs(0);print(paste0("abs(0): ", c))