% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/HDF5Matrix_import.R
\name{hdf5_import}
\alias{hdf5_import}
\title{Import data from file or URL into HDF5 format}
\usage{
hdf5_import(
  source,
  filename,
  dataset,
  sep = NULL,
  header = TRUE,
  rownames = FALSE,
  overwrite = FALSE,
  parallel = TRUE,
  threads = NULL
)
}
\arguments{
\item{source}{Character. Path to local file or URL to import.
Supports compressed files (.gz, .tar.gz, .zip, .bz2).}

\item{filename}{Character. Path to HDF5 output file (created if doesn't exist).}

\item{dataset}{Character. Full dataset path (e.g., "data/imported" or "group/dataset").}

\item{sep}{Character. Field separator. Default \code{NULL} (auto-detect from extension:
"," for .csv, "\\t" for .tsv, "\\t" otherwise).}

\item{header}{Logical or character vector. If \code{TRUE}, first row contains column
names. If character vector, use these as column names. Default \code{TRUE}.}

\item{rownames}{Logical or character vector. If \code{TRUE}, first column contains
row names. If character vector, use these as row names. Default \code{FALSE}.}

\item{overwrite}{Logical. If \code{TRUE}, overwrite dataset if exists.
Default \code{FALSE}.}

\item{parallel}{Logical. Use parallel processing for import. Default \code{TRUE}.}

\item{threads}{Integer. Number of threads for parallel processing. Default \code{NULL}
(uses all available cores).}
}
\value{
\code{HDF5Matrix} object pointing to the imported data.
}
\description{
Modern wrapper for importing CSV, TSV, or other delimited text files into
HDF5 format. Returns an \code{HDF5Matrix} object ready for use.
}
\details{
This function is a modern, user-friendly wrapper around \code{\link{bdImportData_hdf5}}
and \code{\link{bdImportTextFile_hdf5}}. It:

\itemize{
\item Automatically detects file format from extension
\item Handles compressed files (.gz, .tar.gz, .zip)
\item Downloads from URLs automatically
\item Returns ready-to-use \code{HDF5Matrix} object
\item Uses sensible defaults for most use cases
}

\strong{Supported formats:}
\itemize{
\item CSV files (.csv) - comma-separated
\item TSV files (.tsv, .txt) - tab-separated
\item Compressed files (.gz, .tar.gz, .zip, .bz2)
\item Remote files (http://, https://, ftp://)
}

\strong{Memory efficiency:}
Import is done in a streaming fashion, so very large files can be imported
without loading them entirely into memory.
}
\examples{
\donttest{
csv_file  <- tempfile(fileext = ".csv")
hdf5_file <- tempfile(fileext = ".h5")

# Write sample numeric data
write.table(matrix(rnorm(50), nrow = 10, ncol = 5),
            csv_file, sep = ",", row.names = FALSE, col.names = TRUE)

# Import CSV to HDF5
mat <- hdf5_import(
  source   = csv_file,
  filename = hdf5_file,
  dataset  = "raw/data",
  sep      = ","
)
dim(mat)

hdf5_close_all()
unlink(c(csv_file, hdf5_file))
}

}
\seealso{
\code{\link{bdImportData_hdf5}} for the underlying implementation,
\code{\link{hdf5_create_matrix}} for creating matrices from R objects
}
