abs(x) computes the absolute value of x, sqrt(x) computes the (principal) square root of x, \(\sqrt{x}\). The naming follows the standard for computer languages such as C or Fortran.
abs(x)
sqrt(x)
| Parameter | Description |
|---|---|
x |
a numeric or complex vector or array. |
# NOT RUN {
require(stats) # for spline
require(graphics)
xx <- -9:9
plot(xx, sqrt(abs(xx)), col = "red")
lines(spline(xx, sqrt(abs(xx)), n=101), col = "pink")
# }