https://github.com/cran/pracma
Revision d5bfb0e3b7a3211ff2bbe2926e5ba31aa24e4df6 authored by HwB on 09 March 2012, 00:00:00 UTC, committed by Gabor Csardi on 09 March 2012, 00:00:00 UTC
1 parent 63e8a52
Raw File
Tip revision: d5bfb0e3b7a3211ff2bbe2926e5ba31aa24e4df6 authored by HwB on 09 March 2012, 00:00:00 UTC
version 1.0.1
Tip revision: d5bfb0e
interval.Rd
\name{interv_union}
\alias{interv_union}
\alias{interv_intersect}
\title{
  Interval Functions
}
\description{
  Functions for determining the union or intersection of a set of (closed)
  intervals of the real number line.
}
\usage{
interv_union(M)
interv_intersect(M)
}
\arguments{
  \item{M}{matrix representing a set of intervals.}
}
\details{
  Intersection is easy, as it is the interval from the maximum of left end
  points to the minimum of the right end points (or NULL if the maximum is
  greater than the minimum).

  NEW: Vectorized according to an idea of William Dunlap on R-help 01-2012.\cr
  OLD: For the union, the intervals are first ordered by left endpoints,
  then a simple loop checking intersection of two adjacent intervals.
}
\value{
  Another matrix representing a set of intervals.
}
\author{
  HwB  email: <hwborchers@googlemail.com>
}
\examples{
set.seed(8237)
x <- sample(1:100, 10)
M <- cbind(x, x+10)

interv_union(M)
interv_intersect(M)
}
\keyword{ manip }
back to top