dell: Data ellipse in 2D

Description Usage Arguments Value Author(s) See Also Examples

View source: R/ell.R

Description

Calculates points on a 2D data ellipse

Usage

1
dell(x, y, radius = 1, ...)

Arguments

x

A numeric vector, or a two-column matrix, or a data.frame

y

A numeric vector

radius

Radius of the ellipse

...

Arguments passed to ell, including n, the number of points on the ellipse.

Value

dell returns an object of class ell consisting of a matrix whose rows are points on the ellipse and, thus, can be plotted with plot or lines.

Author(s)

Georges Monette

See Also

ell, cell, ~~~

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
##---- 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, radius = 1, ...) {
        if ( (is.matrix(x) && (ncol(x) > 1))|| is.data.frame(x)) mat <- as.matrix(x[,1:2])
        else if (is.list(x)) mat <- cbind(x$x, x$y)
        else mat <- cbind( x,y)
        ell( apply(mat,2,mean), var(mat), radius = radius, ...)
    }

p3d documentation built on May 2, 2019, 5:25 p.m.