export {rtracklayer}R Documentation

Export objects to connections

Description

Exports (serializes) an object in a given format to a given connection.

Usage

export(object, con, format, ...)

Arguments

object

The object to export.

con

The connection to which the object is exported. 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 missing, the function will return the output as a character vector, rather than writing to a connection.

format

The format of the output. If missing and con is a filename, the format is derived from the file extension.

...

Parameters to pass to the format-specific export routine.

Details

This function delegates to another function, depending on the specified format. The name of the delegate is of the form export.format where format is specified by the format argument.

Value

If con is missing, a character vector containing the string output. Otherwise, nothing is returned.

Author(s)

Michael Lawrence

See Also

import for the reverse

Examples

  track <- import(system.file("tests", "v1.gff", package = "rtracklayer"))
  ## Not run: export(track, "my.gff", version = "3")
  ## equivalently,
  ## Not run: export(track, "my.gff3")
  ## or
  ## Not run: 
  con <- file("my.gff3")
  export(track, con, "gff3")
  close(con)
  
## End(Not run)
  ## or as a string
  export(track, format = "gff3")

[Package rtracklayer version 1.14.1 Index]