-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetRange.Rd
46 lines (43 loc) · 1.41 KB
/
setRange.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Plot_eddy.R
\name{setRange}
\alias{setRange}
\title{Set Range for Plotting}
\usage{
setRange(x = NA, filter = TRUE, man = c(0, 0))
}
\arguments{
\item{x}{A numeric vector.}
\item{filter}{A logical vector that can be recycled if necessary to match the
length of \code{x}.}
\item{man}{A numeric vector of length 2.}
}
\description{
\code{setRange} makes sure that the range extracted from \code{x} will be
valid for plotting.
}
\details{
Set range for a given numeric vector \code{x} subsetted by a logical vector
\code{filter}. If the subset contains any finite value, finite range of the
\code{x} subset is returned. Else if \code{x} contains any finite value,
finite range of \code{x} is returned. When no finite value can be found in
\code{x}, range is set manually (default \code{man = c(0, 0)}).
If \code{x} length is higher than \code{filter} length, \code{filter} will be
recycled.
}
\examples{
\dontrun{
(aa <- c(1, NA, Inf, -Inf, 3, NaN, rep(NA, 4)))
range(aa, finite = TRUE)
setRange(aa, TRUE) # same effect
# Useful when applying filters
aa[rep(c(FALSE, TRUE), each = 5)]
suppressWarnings(range(aa[rep(c(FALSE, TRUE), each = 5)], finite = TRUE))
setRange(aa, rep(c(FALSE, TRUE), each = 5)) # range taken from unfiltered 'aa'
setRange(aa[c(FALSE, TRUE)]) # No finite values in 'x', applies 'man' range
}
}
\seealso{
\code{\link{range}}.
}
\keyword{internal}