Learn R Programming

BigDataStatMeth (version 2.0.3)

length.HDF5Matrix: Length of an HDF5Matrix

Description

Returns the total number of elements in an HDF5Matrix object, defined as prod(dim(x)) — consistent with the behaviour of base::length() for ordinary R matrices.

Usage

# S3 method for HDF5Matrix
length(x)

Value

A single integer: nrow(x) * ncol(x).

Arguments

x

An HDF5Matrix object.

Examples

Run this code
# \donttest{
tmp <- tempfile(fileext = ".h5")
X <- hdf5_create_matrix(tmp, "data/m", data = matrix(1:100, 10, 10))
length(X)   # 100
close(X); unlink(tmp)
# }

Run the code above in your browser using DataLab