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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bit.R, R/generics.R
\name{xor.default}
\alias{xor.default}
\alias{xor.logical}
\alias{!.bit}
\alias{&.bit}
\alias{|.bit}
\alias{==.bit}
\alias{!=.bit}
\alias{xor.bit}
\alias{!.bitwhich}
\alias{&.bitwhich}
\alias{|.bitwhich}
\alias{==.bitwhich}
\alias{!=.bitwhich}
\alias{xor.bitwhich}
\alias{&.booltype}
\alias{|.booltype}
\alias{==.booltype}
\alias{!=.booltype}
\alias{xor.booltype}
\alias{xor}
\title{Boolean operators and functions}
\usage{
\method{xor}{default}(x, y)
\method{xor}{logical}(x, y)
\method{!}{bit}(x)
\method{&}{bit}(e1, e2)
\method{|}{bit}(e1, e2)
\method{==}{bit}(e1, e2)
\method{!=}{bit}(e1, e2)
\method{xor}{bit}(x, y)
\method{!}{bitwhich}(x)
\method{&}{bitwhich}(e1, e2)
\method{|}{bitwhich}(e1, e2)
\method{==}{bitwhich}(e1, e2)
\method{!=}{bitwhich}(e1, e2)
\method{xor}{bitwhich}(x, y)
\method{&}{booltype}(e1, e2)
\method{|}{booltype}(e1, e2)
\method{==}{booltype}(e1, e2)
\method{!=}{booltype}(e1, e2)
\method{xor}{booltype}(x, y)
xor(x, y)
}
\arguments{
\item{x}{a \code{\link{is.booltype}} vector}
\item{y}{a \code{\link{is.booltype}} vector}
\item{e1}{a \code{\link{is.booltype}} vector}
\item{e2}{a \code{\link{is.booltype}} vector}
}
\value{
An object of class \code{\link{booltype}} or \code{\link{logical}}
}
\description{
Boolean NEGATION '!', AND '&', OR '|' and EXCLUSIVE OR xor', see \code{\link[base]{Logic}}.
}
\details{
The binary operators and function \code{xor} can now combine any \code{\link{is.booltype}} vectors.
They now recycle if vectors have different length. If the two arguments have different \code{\link{booltypes}} the return value corresponds to the lower \code{\link{booltype}} of the two. \cr
Boolean operations on \code{\link{bit}} vectors are extremely fast because they are
implemented using C's bitwise operators. Boolean operations on or \code{\link{bitwhich}}
vectors are even faster, if they represent very skewed selections. \cr
The \code{xor} function has been made generic and \code{xor.default} has
been implemented much faster than R's standard \code{\link[base:Logic]{xor}}.
This was possible because actually boolean function \code{xor} and
comparison operator \code{!=} do the same (even with NAs), and \code{!=} is
much faster than the multiple calls in \code{(x | y) & !(x & y)}
}
\section{Methods (by class)}{
\itemize{
\item \code{default}: default method for \code{\link{xor}}
\item \code{logical}: \code{\link{logical}} method for \code{\link{xor}}
\item \code{bit}: \code{\link{bit}} method for \code{\link{!}}
\item \code{bit}: \code{\link{bit}} method for \code{\link{&}}
\item \code{bit}: \code{\link{bit}} method for \code{\link{|}}
\item \code{bit}: \code{\link{bit}} method for \code{\link{==}}
\item \code{bit}: \code{\link{bit}} method for \code{\link{!=}}
\item \code{bit}: \code{\link{bit}} method for \code{\link{xor}}
\item \code{bitwhich}: \code{\link{bitwhich}} method for \code{\link{!}}
\item \code{bitwhich}: \code{\link{bitwhich}} method for \code{\link{&}}
\item \code{bitwhich}: \code{\link{bitwhich}} method for \code{\link{|}}
\item \code{bitwhich}: \code{\link{bitwhich}} method for \code{\link{==}}
\item \code{bitwhich}: \code{\link{bitwhich}} method for \code{\link{!=}}
\item \code{bitwhich}: \code{\link{bitwhich}} method for \code{\link{xor}}
\item \code{booltype}: \code{\link{booltype}} method for \code{\link{&}}
\item \code{booltype}: \code{\link{booltype}} method for \code{\link{|}}
\item \code{booltype}: \code{\link{booltype}} method for \code{\link{==}}
\item \code{booltype}: \code{\link{booltype}} method for \code{\link{!=}}
\item \code{booltype}: \code{\link{booltype}} method for \code{\link{xor}}
}}
\examples{
x <- c(FALSE, FALSE, FALSE, NA, NA, NA, TRUE, TRUE, TRUE)
y <- c(FALSE, NA, TRUE, FALSE, NA, TRUE, FALSE, NA, TRUE)
x|y
x|as.bit(y)
x|as.bitwhich(y)
x|as.which(y)
x|ri(1,1,9)
}
\seealso{
\code{\link{booltypes}}, \code{\link{Logic}}
}
\author{
Jens Oehlschlägel
}
\keyword{classes}
\keyword{logic}
|