File: SparseArray-Logic-methods.Rd

package info (click to toggle)
r-bioc-sparsearray 1.6.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,768 kB
  • sloc: ansic: 16,138; makefile: 2
file content (75 lines) | stat: -rw-r--r-- 2,186 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
\name{SparseArray-Logic-methods}

\alias{SparseArray-Logic-methods}
\alias{SparseArray_Logic-methods}
\alias{SparseArray-Logic}
\alias{SparseArray_Logic}
\alias{SparseArray-logic-methods}
\alias{SparseArray_logic-methods}
\alias{SparseArray-logic}
\alias{SparseArray_logic}

\alias{!,SparseArray-method}

\alias{Logic,SVT_SparseArray,vector-method}
\alias{Logic,vector,SVT_SparseArray-method}
\alias{Logic,SVT_SparseArray,SVT_SparseArray-method}
\alias{Logic,SVT_SparseArray,array-method}
\alias{Logic,array,SVT_SparseArray-method}

\title{'Logic' operations on SparseArray objects}

\description{
  \link{SparseArray} derivatives support operations from the \code{Logic}
  group (i.e. \code{&} and \code{|}), with some restrictions.
  See \code{?\link[methods]{S4groupGeneric}} in the \pkg{methods} package
  for more information about the \code{Logic} group generic.

  IMPORTANT NOTES:
  \itemize{
    \item Only \link{SVT_SparseArray} objects are supported at the moment.
          Support for \link{COO_SparseArray} objects might be added in the
          future.
    \item In base R, \code{Logic} operations support input of \code{type()}
          \code{"logical"}, \code{"integer"}, \code{"double"}, or
          \code{"complex"}. However, the corresponding methods for
          \link{SVT_SparseArray} objects only support objects of
          \code{type()} \code{"logical"} for now.
  }
}

\value{
  A \link{SparseArray} derivative of \code{type()} \code{"logical"} and
  same dimensions as the input object(s).
}

\seealso{
  \itemize{
    \item \code{\link[methods]{S4groupGeneric}} in the \pkg{methods} package.

    \item \link{SparseArray} objects.

    \item Ordinary \link[base]{array} objects in base R.
  }
}

\examples{
svt1 <- svt2 <- SVT_SparseArray(dim=c(15, 6))
svt1[cbind(1:15, 2)] <- c(TRUE, FALSE, NA)
svt1[cbind(1:15, 5)] <- c(TRUE, NA, NA, FALSE, TRUE)
svt2[c(2, 6, 12:17, 22:33, 55, 59:62, 90)] <- c(TRUE, NA)

svt1 & svt2
svt1 | svt2

## Sanity checks:
m1 <- as.matrix(svt1)
m2 <- as.matrix(svt2)
stopifnot(
  identical(as.matrix(svt1 & svt2), m1 & m2),
  identical(as.matrix(svt1 | svt2), m1 | m2)
)
}
\keyword{array}
\keyword{methods}
\keyword{algebra}