Comments (6)
Good. I'm closing this. Feel free to re-open if you run into further problems when trying to subset a DelayedArray object of type "list"
.
from delayedarray.
The problem should be addressed in DelayedArray 0.7.29 (ecddbd7).
Don't forget to use drop=FALSE
if you want the result of the above subsetting to be returned as a DelayedArray object (in which case subsetting is delayed).
Note that DelayedArray objects of type "list"
have not received a lot of testing. Right now they work almost by chance. There are certainly things that won't work for these objects like trying to coerce them to HDF5Array:
library(HDF5Array)
m <- matrix(list(1:5, NULL, "a"), nrow=10, ncol=9)
M <- DelayedArray(m)
as(M, "HDF5Array")
# Error in h5createDataset(filepath, name, dim, storage.mode = type, size = size, :
# datatype list not yet implemented. Try 'double', 'integer', or 'character'.
One thing to keep in mind is that even though an operation like log(M)
seems to work:
M2 <- log(M)
it is actually invalid (like log(m)
is). But because log(M)
is delayed, the error is also delayed i.e. we only get it when realization is triggered (implicitly by show()
or explicitly with something like as.matrix(M2)
):
M2
# Error in .Primitive("log")(list()) :
# non-numeric argument to mathematical function
H.
from delayedarray.
I actually just changed this (70fd89a). I didn't realize until now this would be so easy to do (without impacting performance). H.
from delayedarray.
Hi @hpages ,
Seems that the DelayedArray
constructor over an array of type list
could not work now...
> aa <- array(list(), dim=10)
!> DelayedArray(aa)
Error in type(x) :
type() only supports array-like objects. See ?type in the DelayedArray
package.
!> packageVersion("DelayedArray")
[1] ‘0.7.30’
from delayedarray.
mmmh... I can't reproduce this. Could it be that you have some packages loaded that conflict with DelayedArray? Can you try this again in a fresh R session and show your sessionInto()
? Here is what I get:
> library(DelayedArray)
> DelayedArray(array(list(), dim=10))
<10> DelayedArray object of type "list":
[1] [2] [3] . [9] [10]
NULL NULL NULL . NULL NULL
> sessionInfo()
R version 3.5.1 Patched (2018-08-01 r75051)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS
Matrix products: default
BLAS: /home/hpages/R/R-3.5.r75051/lib/libRblas.so
LAPACK: /home/hpages/R/R-3.5.r75051/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats4 stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] DelayedArray_0.7.30 BiocParallel_1.15.8 IRanges_2.15.16
[4] S4Vectors_0.19.19 BiocGenerics_0.27.1 matrixStats_0.54.0
loaded via a namespace (and not attached):
[1] compiler_3.5.1
Thanks!
from delayedarray.
Yes, it works in a fresh new R session. I have a local repo for DelayedArray
, where I have exported the DelayedUnaryOp
and DelayedOp
manually because of a bug in devtools
(r-lib/devtools#1845), so that every time I use document()
or load_all()
, the class of DelayedMatrix
will not lose any extended classes.
> getClass("VCFMatrix")
Class "VCFMatrix" [package "VCFArray"]
Slots:
Name: seed
Class: ANY
Extends:
Class "DelayedMatrix", directly
Class "VCFArray", directly
Class "DelayedArray", by class "DelayedMatrix", distance 2
Class "DelayedUnaryOp", by class "DelayedMatrix", distance 2
Class "DelayedOp", by class "DelayedMatrix", distance 2
Class "Array", by class "DelayedMatrix", distance 2
Class "DataTable", by class "DelayedMatrix", distance 2
Class "DataTable_OR_NULL", by class "DelayedMatrix", distance 3
Otherwise, with a second load_all()
or document()
it will look like this:
> getClass("VCFMatrix")
Class "VCFMatrix" [package "VCFArray"]
Slots:
Name: seed
Class: ANY
Extends:
Class "DelayedMatrix", directly
Class "VCFArray", directly
Class "DelayedArray", by class "DelayedMatrix", distance 2
Class "Array", by class "DelayedMatrix", distance 2
Class "DataTable", by class "DelayedMatrix", distance 2
Class "DataTable_OR_NULL", by class "DelayedMatrix", distance 3
My error from last comment might comes from here because I have only updated the DelayedArray 0.7.30
and didn't manually install the local changes...
Qian
from delayedarray.
Related Issues (20)
- Have extract_array() accept non-integer dim() outputs HOT 1
- Where can i find the old version HOT 1
- Can't `cbind` DelayedArray instances with other matrix-likes
- More elements in the method signature (2) than in the generic signature (1) for function ‘type<-’ HOT 2
- Bioconductor devel / multiple methods tables found for ‘aperm’ HOT 1
- Install error HOT 2
- `set_grid_context()` changed in `RELEASE_3_17` HOT 2
- Thoughts on migrating from `read_sparse_block()` to SVTs HOT 2
- rowRanges/colRanges not preserving row/col names HOT 2
- colMaxs/rowMaxs and colMins/rowMins useNames behavior incorrect in RELEASE_3_17 HOT 2
- `NSBS` method for `DelayedArray` objects? HOT 3
- Unable to find an inherited method for function ‘OLD_extract_sparse_array’ for signature ‘"CSR_H5SparseMatrixSeed"’ HOT 2
- Feature request: add `BPCell` backend HOT 8
- Feature request: make `seedApply` as a generic function HOT 4
- More informative error than `the supplied seed must support extract_array()` HOT 3
- Inconsistent `dimnames` after matrix multiplication with zero-column output HOT 2
- Importing DelayedArray messes up as.vector() for Arrow arrays HOT 1
- DelayedMatrixStats no longer supports scalar `center=` arguments HOT 5
- `base::cbind()`
- the problem "the supplied seed must support extract_array() " HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delayedarray.