File: Bimap-envirAPI.Rd

package info (click to toggle)
r-bioc-annotationdbi 1.68.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 8,476 kB
  • sloc: sql: 10,876; makefile: 3; sh: 2
file content (143 lines) | stat: -rw-r--r-- 3,235 bytes parent folder | download | duplicates (2)
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
\name{Bimap-envirAPI}

\alias{Bimap-envirAPI}

\alias{ls}
\alias{ls,Bimap-method}

\alias{exists}
\alias{exists,ANY,ANY,Bimap-method}
\alias{exists,ANY,Bimap,missing-method}


\alias{get}
\alias{get,ANY,ANY,Bimap-method}
\alias{get,ANY,Bimap,missing-method}

\alias{[[,Bimap-method}

\alias{$,Bimap-method}

\alias{mget}
\alias{mget,Bimap-method}
\alias{mget,ANY,Bimap-method}

\alias{eapply}
\alias{eapply,Bimap-method}

\alias{contents,Bimap-method}

\alias{sample}
\alias{sample,Bimap-method}
\alias{sample,environment-method}


\title{Environment-like API for Bimap objects}

\description{
  These methods allow the user to manipulate any \link{Bimap} object as
  if it was an environment. This environment-like API is provided for
  backward compatibility with the traditional environment-based maps.
}

\usage{
  ls(name, pos = -1L, envir = as.environment(pos), all.names = FALSE,
     pattern, sorted = TRUE)
  exists(x, where, envir, frame, mode, inherits)
  get(x, pos, envir, mode, inherits)
  #x[[i]]
  #x$name

  ## Converting to a list
  mget(x, envir, mode, ifnotfound, inherits)
  eapply(env, FUN, ..., all.names, USE.NAMES)

  ## Additional convenience method
  sample(x, size, replace=FALSE, prob=NULL, ...)
}

\arguments{
  \item{name}{
    A \link{Bimap} object for \code{ls}.
    A key as a literal character string or a name (possibly backtick quoted)
    for \code{x$name}.
  }
  \item{pos, all.names, USE.NAMES, where, frame, mode, inherits}{
    Ignored.
  }
  \item{envir}{
    Ignored for \code{ls}. A \link{Bimap} object for \code{mget},
    \code{get} and \code{exists}.
  }
  \item{pattern}{
    An optional regular expression. Only keys matching 'pattern' are returned.
  }
  \item{x}{
    The key(s) to search for for \code{exists}, \code{get} and \code{mget}.
    A \link{Bimap} object for \code{[[} and \code{x$name}.
    A \link{Bimap} object or an environment for \code{sample}.
  }
  \item{i}{
    Single key specifying the map element to extract.
  }
  \item{ifnotfound}{
    A value to be used if the key is not found. Only \code{NA} is currently
    supported.
  }
  \item{env}{
    A \link{Bimap} object.
  }
  \item{FUN}{
    The function to be applied (see original \code{\link[base:eapply]{eapply}}
    for environments for the details).
  }
  \item{...}{
    Optional arguments to \code{FUN}.
  }
  \item{size}{
    Non-negative integer giving the number of map elements to choose.
  }
  \item{replace}{
    Should sampling be with replacement?
  }
  \item{prob}{
    A vector of probability weights for obtaining the elements of the map
    being sampled.
  }
  \item{sorted}{
    \code{logical(1)}. When TRUE (default), return primary keys in
    sorted order.
  }
}

\seealso{
  \code{\link[base:ls]{ls}},
  \code{\link[base:exists]{exists}},
  \code{\link[base:get]{get}},
  \code{\link[base:get]{mget}},
  \code{\link[base:eapply]{eapply}},
  \code{\link[base:sample]{sample}},
  \link{BimapFormatting},
  \link{Bimap}
}

\examples{
  library(hgu95av2.db)
  x <- hgu95av2CHRLOC

  ls(x)[1:3]
  exists(ls(x)[1], x)
  exists("titi", x)
  get(ls(x)[1], x)
  x[[ls(x)[1]]]
  x$titi # NULL

  mget(ls(x)[1:3], x)
  eapply(x, length)

  sample(x, 3)
}

\keyword{methods}
\keyword{interface}