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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bit.R, R/generics.R
\name{maxindex.default}
\alias{maxindex.default}
\alias{poslength.default}
\alias{maxindex.logical}
\alias{poslength.logical}
\alias{maxindex.bit}
\alias{poslength.bit}
\alias{maxindex.bitwhich}
\alias{poslength.bitwhich}
\alias{maxindex.which}
\alias{poslength.which}
\alias{maxindex.ri}
\alias{poslength.ri}
\alias{maxindex}
\alias{poslength}
\title{Get maxindex (length of boolean vector) and poslength (number of 'selected' elements)}
\usage{
\method{maxindex}{default}(x, ...)
\method{poslength}{default}(x, ...)
\method{maxindex}{logical}(x, ...)
\method{poslength}{logical}(x, ...)
\method{maxindex}{bit}(x, ...)
\method{poslength}{bit}(x, ...)
\method{maxindex}{bitwhich}(x, ...)
\method{poslength}{bitwhich}(x, ...)
\method{maxindex}{which}(x, ...)
\method{poslength}{which}(x, ...)
\method{maxindex}{ri}(x, ...)
\method{poslength}{ri}(x, ...)
maxindex(x, ...)
poslength(x, ...)
}
\arguments{
\item{x}{an R object, typically a \code{\link{is.booltype}} object.}
\item{...}{further arguments (ignored)}
}
\value{
an integer scalar
}
\description{
For \code{\link{is.booltype}} objects the term \code{\link{length}} is ambiguous.
For example the length of \code{\link{which}} corresponds to the sum of \code{\link{logical}}.
The generic \code{maxindex} gives \code{length(logical)} for all \code{\link{booltype}s}.
The generic \code{poslength} gives the number of positively selected elements, i.e. \code{sum(logical)} for all \code{\link{booltype}s}
(and gives \code{NA} if \code{NAs} are present).
}
\section{Methods (by class)}{
\itemize{
\item \code{default}: default method for \code{maxindex}
\item \code{default}: default method for \code{poslength}
\item \code{logical}: \code{maxindex} method for class \code{\link{logical}}
\item \code{logical}: \code{poslength} method for class \code{\link{logical}}
\item \code{bit}: \code{maxindex} method for class \code{\link{bit}}
\item \code{bit}: \code{poslength} method for class \code{\link{bit}}
\item \code{bitwhich}: \code{maxindex} method for class \code{\link{bitwhich}}
\item \code{bitwhich}: \code{poslength} method for class \code{\link{bitwhich}}
\item \code{which}: \code{maxindex} method for class \code{\link[=as.which]{which}}
\item \code{which}: \code{poslength} method for class \code{\link[=as.which]{which}}
\item \code{ri}: \code{maxindex} method for class \code{\link{ri}}
\item \code{ri}: \code{poslength} method for class \code{\link{ri}}
}}
\examples{
r <- ri(1,2,12)
i <- as.which(r)
w <- as.bitwhich(r)
b <- as.bit(r)
l <- as.logical(r)
u <- which(l) # unclassed which
sapply(list(r=r,u=u,i=i,w=w,b=b,l=l), function(x){
c(length=length(x), sum=sum(x), maxindex=maxindex(x), poslength=poslength(x))
})
}
|