Description Usage Arguments Details Value S3 as.data.table() S4 as() Note See Also Examples
Coerce to data.table
.
1 2 3 4 5 6 7 8 9 10 | as.data.table(x, keep.rownames = FALSE, ...)
## S3 method for class 'DataFrame'
as.data.table(x, keep.rownames = TRUE, ...)
## S3 method for class 'IPosRanges'
as.data.table(x, keep.rownames = TRUE, ...)
## S3 method for class 'GenomicRanges'
as.data.table(x, keep.rownames = TRUE, ...)
|
x |
An R object. |
keep.rownames |
Default is |
... |
Additional arguments to be passed to or from other methods. |
Our defined methods attempt to improve on the defaults in the data.table
package to ensure that row names are not dropped by default, which is a poor
default for bioinformatics. This is accomplished by setting
keep.rownames = "rowname"
by default instead of keep.rownames = NULL
.
Note that we're manually defining the "rowname"
column instead of using
TRUE
, to match the conventions used in our as_tibble()
methods.
data.table
.
as.data.table()
transformer extends as.data.table()
method
support for these S4 classes:
DataFrame
.
GenomicRanges
.
as()
Since data.table
is a class that extends data.frame
, we need to define an
S4 coercion method that allows us to use as()
to coerce an
object to a data.table
.
See getClass("data.table")
for details.
Updated 2020-01-08.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | data(DataFrame, GRanges, IRanges, package = "acidtest")
## DataFrame to data.table ====
x <- as(DataFrame, "data.table")
x <- as.data.table(DataFrame)
print(x)
## GenomicRanges to data.table ====
x <- as(GRanges, "data.table")
x <- as.data.table(GRanges)
print(x)
## IRanges to data.table ====
x <- as(IRanges, "data.table")
x <- as.data.table(IRanges)
print(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.