Export data out of R and write to disk.

export(object, ...)

# S4 method for SummarizedExperiment
export(
  object,
  name = NULL,
  dir = getOption("acid.export.dir", default = "."),
  compress = getOption("acid.export.compress", default = FALSE),
  overwrite = getOption("acid.overwrite", default = TRUE),
  quiet = getOption("acid.quiet", default = FALSE)
)

Arguments

object

Object. An object supporting dim(), or a supported class capable of being coerced to data.frame, to be written to disk.

name

character(1). Name to use on disk. If NULL, will use the name of the object instead.

dir

character(1). Directory path.

compress

logical(1). Apply gzip compression to all files.

overwrite

logical(1). Overwrite existing file on disk.

quiet

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

...

Additional arguments.

Value

Invisible character. File path(s).

Note

Updated 2021-02-03.

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 vroom::voom_write() by default for exporting data.frame and matrix class objects.

See also

Examples

data(RangedSummarizedExperiment, package = "AcidTest") ## SummarizedExperiment ==== object <- RangedSummarizedExperiment dir <- "example" x <- export(object = object, dir = dir)
#> → Exporting `object` to /Users/mike/git/monorepo/r-packages/acidexperiment/docs/reference/example/object.
#> → Exporting assays `counts` to /Users/mike/git/monorepo/r-packages/acidexperiment/docs/reference/example/object.
#> → Exporting counts.csv at /Users/mike/git/monorepo/r-packages/acidexperiment/docs/reference/example/object/assays using vroom::`vroom_write()`.
#> → Exporting colData.csv at /Users/mike/git/monorepo/r-packages/acidexperiment/docs/reference/example/object using vroom::`vroom_write()`.
#> Dropping non-atomic columns: entrezId.
#> → Exporting rowData.csv at /Users/mike/git/monorepo/r-packages/acidexperiment/docs/reference/example/object using vroom::`vroom_write()`.
print(x)
#> $assays #> $assays$counts #> [1] "/Users/mike/git/monorepo/r-packages/acidexperiment/docs/reference/example/object/assays/counts.csv" #> #> #> $colData #> [1] "/Users/mike/git/monorepo/r-packages/acidexperiment/docs/reference/example/object/colData.csv" #> #> $rowData #> [1] "/Users/mike/git/monorepo/r-packages/acidexperiment/docs/reference/example/object/rowData.csv" #>
unlink(dir, recursive = TRUE)