Description Usage Arguments Value Author(s) See Also Examples
These methods provide convenient access to objects of class dist as well as
conversion to other data structures.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## S3 method for class 'discDist'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S3 method for class 'discDist'
as.vector(x, mode = "any")
## S3 method for class 'discDist'
as.matrix(x, ...)
## S4 method for signature 'discDist'
length(x)
## S3 method for class 'discDist'
x[i, ...]
## S3 method for class 'discDist'
x[[i, ...]]
## S3 method for class 'contDist'
x[i, j, ...]
## S3 method for class 'tDist'
x[i, j, log=FALSE, ...]
## S3 replacement method for class 'contDist'
x[i, j] <- value
## S3 replacement method for class 'tDist'
x[i, j] <- value
|
x |
Object of class |
i |
If |
j |
Either a character string identifying one of the parameters of |
log |
Logical indicating whether the density value should be log transformed. |
row.names |
NULL or a character vector giving the row names for the data frame. Missing values are not allowed. |
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names) is optional. |
mode |
Mode of |
value |
New parameter value(s). |
... |
Additional arguments. |
The conversion functions return objects of the respective class.
length returns the number of symbols in the alphabet of x.
The access functions return either the requested parameter value or the value of the dansity
function at point j.
Peter Humburg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## converting "discDist" objects
nucleo <- new("discDist",alpha=c("A","C","G","T"),prob=rep(0.25,times=4))
nucleo.vec <- as.vector(nucleo)
nucleo.mat <- as.matrix(nucleo)
nucleo.df <- as.data.frame(nucleo)
## get number of symbols in alphabet
len <- length(nucleo) # = 4
## get probability for symbol 'A'
nucleo['A'] # = 0.25
## accessing tDist objects
mydt <- new("tDist", mean=0, var=1, df=3)
## evaluate density function
mydt[, 2] # = 0.06750966
mydt[, 1000] # = 3.307954e-12
mydt[, 1000, log=TRUE] # = -26.43469
## access parameter values
mydt[, "mean"] # = 0
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.