Package 'idx2r'

Title: Convert Files to and from IDX Format to Vectors, Matrices and Arrays
Description: Convert files to and from IDX format to vectors, matrices and arrays. IDX is a very simple file format designed for storing vectors and multidimensional matrices in binary format. The format is described on the website from Yann LeCun <http://yann.lecun.com/exdb/mnist/>.
Authors: Erik Doffagne
Maintainer: Erik Doffagne <[email protected]>
License: MIT + file LICENSE
Version: 1.0.0
Built: 2024-11-06 04:41:44 UTC
Source: https://github.com/edoffagne/idx2r

Help Index


Convert Files to and from IDX Format to Vectors, Matrices and Arrays in R

Description

Convert files to and from IDX format to arrays in R. IDX is a format to store vector and arrays in binary format. Reading IDX format is needed for instance to use the MNIST database of handwritten digits from http://yann.lecun.com/exdb/mnist/ provided by Yann LeCun.

Author(s)

Erik Doffagne

See Also

Useful links:

Examples

m = matrix(1:16, nrow = 4)
file_name = file.path(tempdir(),"m.idx")
write_idx(m, file_name)
mr = read_idx(file_name)

Read an IDX file

Description

This function allows to read an IDX file

Usage

read_idx(file_name, endian = "big")

Arguments

file_name

character vector containing the name of the file to be read

endian

whether the file has "big" or "little" endian

Examples

m = matrix(1:16, nrow = 4)
file_name = file.path(tempdir(),"m.idx")
write_idx(m, file_name)  
mr = read_idx(file_name)

Write an array into an IDX file

Description

This function allows to write an array into an IDX file.

Usage

write_idx(x, file_name, endian = "big")

Arguments

x

must be a array or a matrix

file_name

character vector containing the name of the file to be created

endian

whether the file has "big" or "little" endian.

Examples

m = matrix(1:16, nrow = 4)
file_name = file.path(tempdir(),"m.idx")
write_idx(m, file_name)