Type: Package
Title: Convert Files to and from IDX Format to Vectors, Matrices and Arrays
Version: 1.0.0
Date: 2018-02-19
Author: Erik Doffagne
Maintainer: Erik Doffagne <erik.doffagne@gmail.com>
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/.
License: MIT + file LICENSE
URL: https://github.com/edoffagne/idx2r
Suggests: testthat
RoxygenNote: 6.0.1
NeedsCompilation: no
Packaged: 2018-02-19 19:02:14 UTC; erik
Repository: CRAN
Date/Publication: 2018-02-20 09:35:13 UTC

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)