as_data_table: Convert gtf/gff/bam/bed S4 objects to data.table and preserve...

Description Usage Arguments Value Examples

Description

as.data.table converts the input object to data.table, but strips away all other classes except data.table and data.frame.

This internal function is a simple wrapper to as.data.table but also retains the extra class information of the input object.

Usage

1
as_data_table(x, reset_class = FALSE)

Arguments

x

An object that inherits from GRanges.

reset_class

logical (default FALSE). If TRUE, resets the class to "data.table", "data.frame".

Value

A data.table object with input class preserved.

Examples

1
2
3
4
5
6
7
## Not run: 
setClass("foo", contains="GRanges")
x = new("foo", GRanges(letters[1:5], IRanges(1:5, 6:10)))
class(x) # [1] "foo"
class(gread:::as_data_table(x)) # [1] "foo" "data.table" "data.frame"

## End(Not run)

openanalytics/gread documentation built on May 24, 2019, 2:29 p.m.