Description Usage Arguments Value Author(s) See Also Examples
The functions import
and export
load and save
objects from and to particular file formats. The rtracklayer package
implements support for a number of annotation and sequence formats.
1 2 |
object |
The object to export. |
con |
The connection from which data is loaded or to which data
is saved. If this is a character vector, it is assumed to be a
filename and a corresponding file connection is created and then
closed after exporting the object. If a |
format |
The format of the output. If missing and |
text |
If |
... |
Parameters to pass to the format-specific method. |
If con
is missing, a character vector containing the string
output. Otherwise, nothing is returned.
Michael Lawrence
Format-specific options for the popular formats: GFF, BED, Bed15, bedGraph, WIG, BigWig
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 | ## To illustrate export(), import(), and yeild(), we create a class, CSVFILE
.CSVFile <- setClass("CSVFile", contains = "BiocFile")
## Constructor
CSVFile <-
function(resource)
{
.CSVFile(resource = resource)
}
## Define import
setMethod("import", "CSVFile",
function(con, format, text, ...)
{
read.csv(resource(con), ...)
})
## Define export
setMethod("export", c("data.frame", "CSVFile"),
function(object, con, format, ...)
{
write.csv(object, resource(con), ...)
})
## Usage
temp <- tempfile(fileext = ".csv")
csv <- CSVFile(temp)
export(mtcars, csv)
df <- import(csv)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.