export: Export data from R

exportR Documentation

Export data from R

Description

Export data from R

Usage

export(object, con, ...)

## S4 method for signature 'SingleCellExperiment,character'
export(object, con, compress = FALSE, overwrite = TRUE, quiet = FALSE)

Arguments

object

Object.

con

character(1) or connection. Data connection. Use character(1) to represent a file path.

compress

logical(1) or character(1). These character strings are currently allowed for save(): "gzip", "bzip2", or "xz".

overwrite

logical(1). Overwrite existing file on disk.

quiet

logical(1). Perform command quietly, suppressing messages.

...

Additional arguments.

Details

This method extends SummarizedExperiment but also handles export of the reducedDims slot (i.e. containing UMAP, tSNE, and PCA).

Value

Invisible character or list of file paths.

Output file format extension

matrix supported arguments:

  • Comma separated values (CSV): "csv", "csv.bz2", "csv.gz", "csv.xz", "csv.zip".

  • Tab separated values (TSV): "tsv", "tsv.bz2", "tsv.gz", "tsv.xz", "tsv.zip".

Matrix (sparseMatrix) supported arguments:

  • MatrixMarket exchange (MTX): "mtx", "mtx.bz2", "mtx.gz", "mtx.xz", "mtx.zip".

Row names

Some export utilities in R have a tendency to drop row names when writing to disk in CSV format. For example, the readr family of functions never write row names by design. This is a really poor default setting for handling genomic data, which often contain gene identifiers in the row names. Here we're performing any internal tibble coercion step to ensure row names are always moved to a "rowname" column in the CSV export.

Debugging

Note that this function currently wraps readr::write_delim() by default for exporting DFrame, data.frame, and matrix class objects.

Note

Updated 2022-09-13.

See Also

Packages:

Export functions:

  • BiocIO::export().

  • data.table::fwrite().

  • readr::write_delim().

  • rio::export().

  • rtracklayer::export().

  • vroom::vroom_write().

Examples

data(SingleCellExperiment_splatter, package = "AcidTest")

## SingleCellExperiment ====
object <- SingleCellExperiment_splatter
con <- AcidBase::tempdir2()
x <- export(object = object, con = con)
print(x)
AcidBase::unlink2(con)

acidgenomics/r-acidsinglecell documentation built on March 30, 2024, 5:39 a.m.