IdVector objectsR/AllGenerics.R, R/AllMethods.R, R/IdVector-class.R
IdVector-methods.RdThis page documents the S4 generics and methods defined for objects inheriting of the IdVector class.
The IdVector class directly extends Vector and thus inherits of all methods defined for the parent class.
In the usage below, object and x represent an object of class inheriting from IdVector,
and value is an object of a class specified in the S4 method signature or as outlined in 'Accessors'.
ids(object) <- value # S4 method for IdVector ids(object) # S4 method for IdVector ids(object) <- value # S4 method for IdVector names(x) # S4 method for IdVector,ANY names(x) <- value # S4 method for IdVector length(x) # S4 method for IdVector duplicated(x, incomparables = FALSE, ...) # S4 method for IdVector,ANY,ANY,ANY [(x, i, j, ..., drop = TRUE) # S3 method for IdVector as.vector(x, mode = "character") # S3 method for IdVector as.character(x, ...) as.IdVector.default(ids, ...)
| object, x | An object of class inheriting from |
|---|---|
| value | An object of a class specified in the S4 method signature. |
| incomparables | Ignored. |
| i | index specifying elements to extract or replace. |
| j, ..., drop | Ignored. |
| mode | Atomic type of the |
| ids | An atomic vector of identifiers. |
ids(object) returns a character vector of element identifiers.
names(object) is a synonym for compatibility with S4 methods such as mcols(object, use.names = TRUE, ...) .
length(x) returns the number of elements in x.
x[i] returns new IdVector object of the same class as x made of the elements selected by i. i can be missing; an NA-free logical, numeric, or character vector or factor (as ordinary vector or Rle object); or an IntegerRanges object.
as(x, "vector") and as.vector(x) return an atomic vector of identifiers contained in x.
as(x, "vector") and as.vector(x) return a character vector of identifiers contained in x.
as(object, "IdVector") and as.IdVector(object) return an IdVector from the given atomic vector of identifiers.
IdVector, Vector, Vector-setops.
# Constructor ---- iv <- IdVector(ids=head(LETTERS, 6)) mcols(iv) <- DataFrame(row.names = ids(iv), field1=runif(length(iv))) iv#> IdVector of length 6 with 6 unique identifiers #> Ids: A, B, C, D, ... #> Metadata: field1 (1 column)# Accessors ---- ids(iv)#> [1] "A" "B" "C" "D" "E" "F"#> [1] "A" "B" "C" "D" "E" "F"#> [1] 6#> [1] FALSE TRUE FALSE TRUEunique(iv1)#> IdVector of length 2 with 2 unique identifiers #> Ids: A, B #> Metadata: field1 (1 column)#> IdVector of length 4 with 4 unique identifiers #> Ids: A, B, C, D #> Metadata: field1 (1 column)# Subsetting ---- iv1 <- iv[1:5] iv1#> IdVector of length 5 with 5 unique identifiers #> Ids: A, B, C, D, ... #> Metadata: field1 (1 column)# Coercion from IdVector ---- v1 <- as(iv, "vector") c1 <- as(iv, "character")