## Cube and cubic root of a numeric vector
## Copyright (c) 2015, Philippe Grosjean (phgrosjean@sciviews.org)
## Cube of numbers
cube <- function (x)
{
if (!is.numeric(x))
stop("'x' must be numeric")
x^3
}
## Cubic root, like square root
cbrt <- function (x)
{
if (!is.numeric(x))
stop("'x' must be numeric")
x^(1/3)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.