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 |
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.
Erik Doffagne
Useful links:
m = matrix(1:16, nrow = 4) file_name = file.path(tempdir(),"m.idx") write_idx(m, file_name) mr = read_idx(file_name)
m = matrix(1:16, nrow = 4) file_name = file.path(tempdir(),"m.idx") write_idx(m, file_name) mr = read_idx(file_name)
This function allows to read an IDX file
read_idx(file_name, endian = "big")
read_idx(file_name, endian = "big")
file_name |
character vector containing the name of the file to be read |
endian |
whether the file has "big" or "little" endian |
m = matrix(1:16, nrow = 4) file_name = file.path(tempdir(),"m.idx") write_idx(m, file_name) mr = read_idx(file_name)
m = matrix(1:16, nrow = 4) file_name = file.path(tempdir(),"m.idx") write_idx(m, file_name) mr = read_idx(file_name)
This function allows to write an array into an IDX file.
write_idx(x, file_name, endian = "big")
write_idx(x, file_name, endian = "big")
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. |
m = matrix(1:16, nrow = 4) file_name = file.path(tempdir(),"m.idx") write_idx(m, file_name)
m = matrix(1:16, nrow = 4) file_name = file.path(tempdir(),"m.idx") write_idx(m, file_name)