File: CoercionToStandard.Rd

package info (click to toggle)
r-cran-bit 4.6.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,000 kB
  • sloc: ansic: 5,145; sh: 13; makefile: 6
file content (82 lines) | stat: -rw-r--r-- 2,304 bytes parent folder | download
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bit.R
\name{CoercionToStandard}
\alias{CoercionToStandard}
\alias{as.logical.bit}
\alias{as.integer.bit}
\alias{as.double.bit}
\alias{as.integer.bitwhich}
\alias{as.double.bitwhich}
\alias{as.logical.bitwhich}
\alias{as.logical.ri}
\alias{as.integer.ri}
\alias{as.double.ri}
\alias{as.logical.which}
\title{Coercion from bit, bitwhich, which and ri to logical, integer, double}
\usage{
\method{as.logical}{bit}(x, ...)

\method{as.integer}{bit}(x, ...)

\method{as.double}{bit}(x, ...)

\method{as.integer}{bitwhich}(x, ...)

\method{as.double}{bitwhich}(x, ...)

\method{as.logical}{bitwhich}(x, ...)

\method{as.logical}{ri}(x, ...)

\method{as.integer}{ri}(x, ...)

\method{as.double}{ri}(x, ...)

\method{as.logical}{which}(x, length = attr(x, "maxindex"), ...)
}
\arguments{
\item{x}{an object of class \code{\link[=bit]{bit()}}, \code{\link[=bitwhich]{bitwhich()}} or
\code{\link[=ri]{ri()}}}

\item{...}{ignored}

\item{length}{length of the boolean vector (required for \code{as.logical.which})}
}
\value{
\code{\link[=as.logical]{as.logical()}} returns a vector of \verb{FALSE, TRUE},
\code{\link[=as.integer]{as.integer()}} and \code{\link[=as.double]{as.double()}} return a vector of
\verb{0,1}.
}
\description{
Coercion from bit is quite fast because we use a double loop that fixes each
word in a processor register.
}
\examples{

  x <- ri(2, 5, 10)
  y <- as.logical(x)
  y
  stopifnot(identical(y, as.logical(as.bit(x))))
  stopifnot(identical(y, as.logical(as.bitwhich(x))))

  y <- as.integer(x)
  y
  stopifnot(identical(y, as.integer(as.logical(x))))
  stopifnot(identical(y, as.integer(as.bit(x))))
  stopifnot(identical(y, as.integer(as.bitwhich(x))))

  y <- as.double(x)
  y
  stopifnot(identical(y, as.double(as.logical(x))))
  stopifnot(identical(y, as.double(as.bit(x))))
  stopifnot(identical(y, as.double(as.bitwhich(x))))
}
\seealso{
\code{\link{CoercionToStandard}}, \code{\link[=as.booltype]{as.booltype()}}, \code{\link[=as.bit]{as.bit()}},
\code{\link[=as.bitwhich]{as.bitwhich()}} , \code{\link[=as.which]{as.which()}}, \code{\link[=as.ri]{as.ri()}}, \code{\link[ff:as.hi]{ff::as.hi()}},  \code{\link[ff:as.ff]{ff::as.ff()}}
}
\author{
Jens Oehlschlägel
}
\keyword{classes}
\keyword{logic}