rechunkByMargins {beachmat} | R Documentation

## Rechunk by margins

### Description

Convert an existing HDF5Matrix into a pure column- or row-based chunk layout.

### Usage

    rechunkByMargins(x, size=5000, outfile=NULL, outname=NULL,
        outlevel=NULL, byrow=TRUE)

### Arguments

`x` | A HDF5Matrix object.
`size` | An integer scalar specifying the number of elements in each chunk.
`outfile` | A string containing the name for the output HDF5 file, chosen by `getHDF5DumpFile` if not specified.
`outname` | A string containing the name for the output HDF5 data set, chosen by `getHDF5DumpName` if not specified.
`outlevel` | An integer scalar specifying the compression level, chosen by `getHDF5DumpCompressionLevel` if not specified.
`byrow` | A logical scalar indicating if the output file should be row-chunked (default) or column-chunked.

### Details

Pure column- or row-based chunk layouts are optimal for random column and row access, respectively, from a HDF5 file. This function can be used to convert a file into a pure row/column layout prior to calling other functions. In many cases, a small investment in rechunking time is repaid by a reduction in access times in downstream procedures.

### Value

A HDF5Matrix object pointing to the HDF5 file containing the data from `x` but with the new chunk layout.

### Author(s)

Aaron Lun

### Examples

    A <- as(matrix(runif(5000), nrow=100, ncol=50), "HDF5Array")
    byrow <- rechunkByMargins(A, byrow=TRUE)
    bycol <- rechunkByMargins(A, byrow=FALSE)

[Package beachmat version 1.2.1 Index]