?Bimap for a quick overview of the Bimap
  objects and their interface).They are divided in 2 groups: (1) methods for getting or setting the direction of a Bimap object and (2) methods for getting, counting or setting the left or right keys (or mapped keys only) of a Bimap object. Note that all the methods in group (2) are undirected methods i.e. what they return does NOT depend on the direction of the map (more on this below).
## Getting or setting the direction of a Bimap object
direction(x)
direction(x) <- value
revmap(x, ...)
## Getting, counting or setting the left or right keys (or mapped
## keys only) of a Bimap object
Lkeys(x)
Rkeys(x)
Llength(x)
Rlength(x)
mappedLkeys(x)
mappedRkeys(x)
count.mappedLkeys(x)
count.mappedRkeys(x)
Lkeys(x) <- value
Rkeys(x) <- value
"subset"(x, Lkeys = NULL, Rkeys = NULL, drop.invalid.keys = FALSE)
"subset"(x, Lkeys = NULL, Rkeys = NULL, drop.invalid.keys = FALSE,  objName = NULL)direction(x) <- value.
    A character vector containing the new keys (must be a subset of the
    current keys) in Lkeys(x) <- value and Rkeys(x) <- value.
  revmap and subset.
    
    Extra argument for revmap can be:
    objNamex is an
        AnnDbBimap object).
      
    Extra arguments for subset can be:
    
Lkeys
Rkeys
drop.invalid.keysdrop.invalid.keys=FALSE (the default), an error will be raised
        if the new Lkeys or Rkeys contain invalid keys i.e. keys that don't belong
        to the current Lkeys or Rkeys.
        If drop.invalid.keys=TRUE, invalid keys are silently dropped.
      
objNamex is an
        AnnDbBimap object).
      
1L or -1L for direction.A Bimap object of the same subtype as x for revmap
  and subset.A character vector for Lkeys, Rkeys, mappedLkeys
  and mappedRkeys.A single non-negative integer for Llength, Rlength,
  count.mappedLkeys and count.mappedRkeys.
x that maps from left to right is
  considered to be a direct map. Otherwise it is considered to be an
  indirect map (when it maps from right to left).  direction returns 1 on a direct map and -1
  otherwise.
  The direction of x can be changed with direction(x) <- value
  where value must be 1 or -1.
  An easy way to reverse a map (i.e. to change its direction) is to
  do direction(x) <- - direction(x), or, even better, to use
  revmap(x) which is actually the recommended way for doing it.
  The Lkeys and Rkeys methods return respectively
  the left and right keys of a Bimap object.
  Unlike the keys method (see ?keys for
  more information), these methods are direction-independent i.e. what
  they return does NOT depend on the direction of the map.
  Such methods are also said to be "undirected methods" 
  and methods like the keys method are said
  to be "directed methods".
All the methods described below are also "undirected methods".
  Llength(x) and Rlength(x) are equivalent to
  (but more efficient than) length(Lkeys(x)) and
  length(Rkeys(x)), respectively.
  The mappedLkeys (or mappedRkeys) method returns
  the left keys (or right keys) that are mapped to at least one right
  key (or one left key).
  count.mappedLkeys(x) and count.mappedRkeys(x) are
  equivalent to (but more efficient than) length(mappedLkeys(x))
  and length(mappedRkeys(x)), respectively.  These functions give
  overall summaries, if you want to know how many Rkeys correspond to a
  given Lkey you can use the nhit function.
  Lkeys(x) <- value and Rkeys(x) <- value are the
  undirected versions of keys(x) <- value (see ?keys
  for more information) and subset(x, Lkeys=new_Lkeys, Rkeys=new_Rkeys)
  is provided as a convenient way to reduce the sets of left
  and right keys in one single function call.
nhit
  library(hgu95av2.db)
  ls(2)
  x <- hgu95av2GO
  x
  summary(x)
  direction(x)
  length(x)
  Llength(x)
  Rlength(x)
  keys(x)[1:4]
  Lkeys(x)[1:4]
  Rkeys(x)[1:4]
  count.mappedkeys(x)
  count.mappedLkeys(x)
  count.mappedRkeys(x)
  mappedkeys(x)[1:4]
  mappedLkeys(x)[1:4]
  mappedRkeys(x)[1:4]
  y <- revmap(x)
  y
  summary(y)
  direction(y)
  length(y)
  Llength(y)
  Rlength(y)
  keys(y)[1:4]
  Lkeys(y)[1:4]
  Rkeys(y)[1:4]
  ## etc...
  ## Get rid of all unmapped keys (left and right)
  z <- subset(y, Lkeys=mappedLkeys(y), Rkeys=mappedRkeys(y))
Run the code above in your browser using DataLab