tests/loadFiles.R

#!/usr/bin/Rscript

library(RcppCNPy)

fmat <- npyLoad("fmat.npy")
print(fmat)
stopifnot(all.equal(fmat, t(matrix(seq(0,11) * 1.1, 4, 3))))

fmat <- npyLoad("fmat.npy.gz")
print(fmat)
stopifnot(all.equal(fmat, t(matrix(seq(0,11) * 1.1, 4, 3))))

imat <- npyLoad("imat.npy", "integer")
print(imat)
stopifnot(all.equal(imat, t(matrix(seq(0,11), 4, 3))))

fvec <- npyLoad("fvec.npy")
print(fvec)
stopifnot(all.equal(fvec, seq(0,4) * 1.1))

ivec <- npyLoad("ivec.npy", "integer")
print(ivec)
stopifnot(all.equal(ivec, seq(0,4)))

Try the RcppCNPy package in your browser

Any scripts or data that you put into this service are public.

RcppCNPy documentation built on Nov. 27, 2023, 5:09 p.m.