Description Usage Arguments Examples
Please refer to the file /inst/doc/readme.pdf.
1 | getArea(x, y)
|
x |
|
y |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, y)
{
x <- x/max(x)
y <- y/max(y)
if (!(is.numeric(x) || is.complex(x)) || !(is.numeric(y) ||
is.complex(y))) {
stop("Arguments 'x' and 'y' must be real or complex vectors.")
}
if (length(x) != length(y)) {
stop("The length of two input vectors should be equal!")
}
m <- length(x)
n <- 2 * m
xp <- c(x, x[m:1])
yp <- c(numeric(m), y[m:1])
p1 <- sum(xp[1:(n - 1)] * yp[2:n]) + xp[n] * yp[1]
p2 <- sum(xp[2:n] * yp[1:(n - 1)]) + xp[1] * yp[n]
return(0.5 * (p1 - p2))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.