Open privefl opened 8 years ago
No, it is a bug. What works (and what I have been doing) is:
x <- matrix(as.raw(sample(0:255, 100)), 10, 10)
m<-big.matrix(10,10,type='raw')
m[,]<-x
I'll look at it.
Now your code work as expected.
Thank you for testing my patch :-)
Hence the perpetual need for more unit tests :)
So here it is :-)
Thanks @adamryczkowski. I've merged the pull request.
@adamryczkowski I'll continue here, because this is about "raw" big.matrices. This is only a minor bug, but subsetting with a matrix is returning numeric elements, not raw ones.
Example:
x <- matrix(as.raw(sample(0:255, 100)), 10, 10)
X <- as.big.matrix(x, type = "raw") # so this now works :-)
ind <- cbind(1, 2:3)
ind
X[ind]
X[1, 2:3]
@adamryczkowski More on this:
X <- bigmemory::big.matrix(1, 1, type = "raw", init = 0)
testthat::expect_identical(X[1, 1], as.raw(0))
testthat::expect_identical(X[1], 0L) # should be 00, but okay..
While X[1, 1]
works fine, X[1]
returns an integer instead of a raw (not really a major issue but still).
However, one major issue is that X[1]
now returns NA
on new Macs.
I tried:
Am I doing something wrong or is it a missing implementation?
@adamryczkowski