as.numeric-methods {haplotypes} | R Documentation |
Coerces a Dna
object to a numeric matrix
Description
Converts a character matrix to a numeric matrix.
Usage
## S4 method for signature 'Dna'
as.numeric(x)
Arguments
x |
an object of class |
Details
Function as.numeric()
coerces the character matrix in the slot sequence
to a numeric matrix.
Lower or upper case characters "?","A","C","G","T","-" are converted to integers 0,1,2,3,4,5, respectively.
Value
returns a numeric matrix.
Methods
signature(x = "Dna")
-
coerces a Dna object to a numeric matrix.
Examples
x<-matrix(c("?","A","C","g","t","-","0","1","2","3","4","5"),4,6)
rownames(x)<-c("seq1","seq2","seq3","seq4")
x<-as.dna(x)
# original character matrix
as.matrix(x)
## Coercing a 'Dna' object to a numeric matrix.
# numeric matrix
as.numeric(x)
[Package haplotypes version 1.1.3.1 Index]