kaneplusplus / bigmemory

126 stars 24 forks source link

Question about multiplyr fix #77

Closed kaneplusplus closed 7 years ago

kaneplusplus commented 7 years ago

@privefl Thanks very much for the multiplyr pull request. @jeblundell has committed it and the new version of bigmemory should be on CRAN soon.

I was just reviewing the change here. Can you tell me what the problem was? I'm having trouble isolating it with a simple example:

library(bigmemory)
x <- big.matrix(5, 2, type="integer", init=0,
                dimnames=list(NULL, c("alpha", "beta")))

# I thought the following would reproduce the problem.
x[x[,1] < 3, 2]
privefl commented 7 years ago

With the latest development version:

# devtools::install_github("kaneplusplus/bigmemory")
library(bigmemory)

a <- big.matrix(2, 2)
a[c(FALSE, TRUE), 2] <- 1

Error in a[c(FALSE, TRUE), 2] <- 1 : object of type 'S4' is not subsettable

Might be a bug we introduced?

jeblundell commented 7 years ago

Reproducible case:

arr <- big.matrix (5, 5)
arr[c(TRUE,FALSE,TRUE,FALSE,TRUE),] <- 123

Reproducible test script:


library (bigmemory)
arr <- big.matrix (5, 5)
try (arr[c(TRUE,FALSE,TRUE,FALSE,TRUE),] <- 123, silent=T)
if (!is.na(arr[1,1])) {
    cat ("\nTEST GOOD\n")
} else {
    cat ("\nTEST BAD\n")
}

Bisect result: 27e609a4e19b56011740b01fe77767cc168fd730 is the first bad commit

jeblundell commented 7 years ago

It's not recognising the signatures on the method as it explicitly needs numeric rather than logical. I'm just throwing together a quick patch