serialization - How can I save and load a bigmemory::big.matrix object in R? -


i'm trying use big.matrix objects in r code, i'm having trouble saving them file using saverds, how save objects:

> library(bigmemory) loading required package: bigmemory.sri loading required package: bh  bigmemory >= 4.0 major revision since 3.1.2; please see packages biganalytics , and bigtabulate , http://www.bigmemory.org more information.  > x <- big.matrix(5, 2, type="integer", init=0, + dimnames=list(null, c("alpha", "beta"))) > saverds(x, "bigmem-test.rds") > y <- readrds("bigmem-test.rds") > y object of class "big.matrix" slot "address": <pointer: (nil)>  > print(y[])   *** caught segfault *** address 0x51, cause 'memory not mapped'  traceback:  1: .call("getmatrixall", x@address)  2: getall.bm(x)  3: .local(x, ...)  4: y[]  5: y[]  possible actions: 1: abort (with core dump, if enabled) 2: normal r exit 3: exit r without saving workspace 4: exit r saving workspace selection: 3 

i assume saverds somehow failing realize big.matrix object pointer other memory, , saving pointer. there way can work around this?

(i don't want use file-backed big.matrix object because object want save complex data structure containing 1 or more big.matrix objects, need backing file each big.matrix contained in object, , object serialized indeterminate number of files instead of one.)

but big.memory objects sit behind external pointer outside control of r. means you're idea of saving them rds objects from r doomed start.

you cast them normal objects eating lots of memory , write rds. otherwise maybe filebased.bigmatrix() ?


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -