IdVector-methods: Methods for 'IdVector' objects

Description Usage Arguments Accessors Dimensions Subsetting Coercion Author(s) See Also Examples

Description

This 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'.

Usage

 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
ids(object) <- value

## S4 method for signature 'IdVector'
ids(object)

## S4 replacement method for signature 'IdVector'
ids(object) <- value

## S4 method for signature 'IdVector'
names(x)

## S4 replacement method for signature 'IdVector,ANY'
names(x) <- value

## S4 method for signature 'IdVector'
length(x)

## S4 method for signature 'IdVector'
duplicated(x, incomparables = FALSE, ...)

## S4 method for signature 'IdVector,ANY,ANY,ANY'
x[i, j, ..., drop = TRUE]

## S3 method for class 'IdVector'
as.vector(x, mode = "character")

## S3 method for class 'IdVector'
as.character(x, ...)

as.IdVector.default(ids, ...)

Arguments

object, x

An object of class inheriting from IdVector.

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 vector() returned. character string naming an atomic mode or "list" or "expression" or (except for vector) "any".

ids

An atomic vector of identifiers.

Accessors

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, ...) .

Dimensions

length(x) returns the number of elements in x.

Subsetting

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.

Coercion

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.

Author(s)

Kevin Rue-Albrecht

See Also

IdVector, Vector, Vector-setops.

Examples

 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
# Constructor ----

iv <- IdVector(ids=head(LETTERS, 6))
mcols(iv) <- DataFrame(row.names = ids(iv), field1=runif(length(iv)))
iv

# Accessors ----

ids(iv)
iv1 <- iv
ids(iv1)[1] <- "gene1"

names(iv)
iv1 <- iv
names(iv1)[1] <- "GENE001"

# Dimensions ----

length(iv)

# Duplication ----

iv1 <- iv[c(1, 1, 2, 2)]
duplicated(iv1)
unique(iv1)

iv1 <- iv[1:3]
iv2 <- iv[2:4]
union(iv1, iv2)

# Subsetting ----

iv1 <- iv[1:5]
iv1

# Coercion from IdVector ----

v1 <- as(iv, "vector")
c1 <- as(iv, "character")

kevinrue/unisets documentation built on May 15, 2020, 10:48 p.m.