Learn R Programming

BigDataStatMeth (version 1.0.3)

bdCreate_hdf5_matrix: Create hdf5 data file and write data to it

Description

Creates a hdf5 file with numerical data matrix,

Usage

bdCreate_hdf5_matrix(
  filename,
  object,
  group = NULL,
  dataset = NULL,
  transp = NULL,
  overwriteFile = NULL,
  overwriteDataset = NULL,
  unlimited = NULL
)

Value

List with components:

fn

Character string with the HDF5 filename

ds

Character string with the full dataset path to the created matrix (group/dataset)

Arguments

filename,

character array indicating the name of the file to create

object

numerical data matrix

group,

character array indicating folder name to put the matrix in hdf5 file

dataset,

character array indicating the dataset name to store the matrix data

transp

boolean, if trans=true matrix is stored transposed in hdf5 file

overwriteFile,

optional boolean by default overwriteFile = false, if true and file exists, removes old file and creates a new file with de dataset data.

overwriteDataset,

optional boolean by default overwriteDataset = false, if true and dataset exists, removes old dataset and creates a new dataset.

unlimited,

optional boolean by default unlimited = false, if true creates a dataset that can growth.

Examples

Run this code

matA <- matrix(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15), nrow = 3, byrow = TRUE)
bdCreate_hdf5_matrix(filename = "test_temp.hdf5", 
                    object = matA, group = "datasets", 
                    dataset = "datasetA", transp = FALSE, 
                    overwriteFile = TRUE, 
                    overwriteDataset = TRUE,
                    unlimited = FALSE)

# Remove file (used as example)
  if (file.exists("test_temp.hdf5")) {
    # Delete file if it exist
    file.remove("test_temp.hdf5")
  }

Run the code above in your browser using DataLab