| 1 |
\name{quadrant} |
| 2 |
\alias{quadrant} |
| 3 |
\title{Give the Quadrant Number of Planar Points} |
| 4 |
\description{ |
| 5 |
Determine the quadrant of planar points, i.e. in which of the four |
| 6 |
parts cut by the x- and y- axis the points lie. Zero values |
| 7 |
(i.e. points on the axes) are treated as if \emph{positive}. |
| 8 |
} |
| 9 |
\usage{ |
| 10 |
quadrant(x, y=NULL) |
| 11 |
} |
| 12 |
\arguments{ |
| 13 |
\item{x,y}{numeric vectors of the same length, or \code{x} is an \eqn{x-y} |
| 14 |
structure and \code{y=NULL}, see \code{\link{xy.coords}}.} |
| 15 |
} |
| 16 |
\value{ |
| 17 |
numeric vector of same length as \code{x} (if that's a vector) with |
| 18 |
values in \code{1:4} indicating the quadrant number of the |
| 19 |
corresponding point. |
| 20 |
} |
| 21 |
%%\seealso{ ~~objects to See Also as \code{\link{~~fun~~}}, ~~~ } |
| 22 |
\examples{ |
| 23 |
xy <- as.matrix(expand.grid(x= -7:7, y= -7:7)); rownames(xy) <- NULL |
| 24 |
(qu <- quadrant(xy)) |
| 25 |
plot(xy, col = qu+1, main = "quadrant() number", axes = FALSE) |
| 26 |
abline(h=0, v=0, col="gray") # the x- and y- axis |
| 27 |
text(xy, lab = qu, col = qu+1, adj = c(1.4,0)) |
| 28 |
} |
| 29 |
\keyword{utilities} |
| 30 |
|