% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/S3_subset.R
\name{[.HDF5Matrix}
\alias{[.HDF5Matrix}
\title{Subset an HDF5Matrix}
\usage{
\method{[}{HDF5Matrix}(x, i, j, drop = TRUE, ...)
}
\arguments{
\item{x}{An \code{HDF5Matrix} object}

\item{i}{Row indices: numeric, integer, logical, or missing}

\item{j}{Column indices: numeric, integer, logical, or missing}

\item{drop}{Logical, whether to drop dimensions for single row/column
results (default \code{TRUE})}

\item{...}{Ignored}
}
\value{
Numeric matrix, or vector when \code{drop = TRUE} and one dimension
has length 1
}
\description{
Subset an HDF5Matrix
}
\details{
All standard R indexing modes are supported:
\itemize{
\item Contiguous ranges: \code{X[1:100, 1:50]}
\item Non-contiguous: \code{X[c(1,3,5), c(2,4)]}
\item Negative: \code{X[-c(1,2), ]} (all except rows 1 and 2)
\item Logical: \code{X[row_mask, col_mask]}
\item Missing: \code{X[, ]} (entire dataset)
}
}
\examples{
\donttest{
tmp <- tempfile(fileext = ".h5")

X  <- hdf5_create_matrix(tmp, "data/matrix", data = matrix(rnorm(100), 10, 10))
X <- hdf5_matrix(tmp, "data/matrix")

X[1:5, 1:3]               # submatrix
X[1, ]                    # single row as vector
X[1, , drop = FALSE]      # single row as matrix
X[, 2]                    # single column as vector
X[-c(1, 10), ]            # all except first and last row
X[c(TRUE, FALSE), ]       # logical row index
X[, ]                     # entire dataset

X$close()
unlink(tmp)
}

}
