Data Access Library User's Guide
Without data, there is no data analysis. Accessing data is an essential step in any data analysis work flow. Numerics.NET provides a unified API for loading and storing objects like data frames, vectors, and matrices from a variety of data sources. The unified API makes it very simple to switch between data sources.
Overview
In this section:
Data Files and Data Streams Basic design of the data access library.
Text-based formats
Text Files The particulars of text-based formats.
Delimited text files Reading and writing delimited text formats such as Comma Separated Values (CSV) and Tab Separated Values (TSV).
Fixed-width Text Files Reading text files with fixed width columns.
Matrix Market Files A human-readable exchange format for dense or sparse vectors and matrices with real or complex elements.
JSON Serialization Reading and writing files in JSON format. Serializing and deserializing data frames, vectors, and matrices using the JSON.NET library.
Binary data formats
Matlab Files Reading Matlab®'s proprietary .mat file format.
R files Reading and writing files in R's .rda/.rdata and .rds formats.
Stata Files Reading data frames from stata®'s .dta files.
Databases
Accessing Databases Reading from data readers and converting to and from data tables.
C# 14 convenience API
Numerics.NET.Data also provides a convenience API through DataFrameDataExtensions, MatrixDataExtensions, and VectorDataExtensions. These methods are thin forwarding wrappers for common operations and do not replace the format-specific APIs such as DelimitedTextFile, MatrixMarketFile, RdataFile, StataFile, and MatlabFile.
Static convenience read methods (for example Matrix.ReadCsv(...), Vector.ReadMatrixMarket(...), and DataFrame.ReadRData(...)) require C# 14 or later. Projects using earlier C# versions should continue to use the format-specific APIs directly.
Path-based convenience write methods create a new file or overwrite an existing file. They do not append to or update existing container files.
For RData and Matlab files, the overload without a name reads the first object in the file. If that object cannot be read as the requested target type, the method throws. Use the named overloads or the format-specific API to select a different object.
JSON convenience methods are intentionally not part of this API surface.