Displaying 20 results from an estimated 600 matches similar to: "Saving R-objects to a database"
2013 Jul 15
2
Serialize data.frame to database
Dear R-Users,
I need a very fast and reliable database solution so I try to serialize a data.frame (to binary data) and to store this data to an SQLite database.
This is what I tried to do:
library(RSQLite)
con <- dbDriver("SQLite")
db <- dbConnect(con, "test")
dbSendQuery(db, 'CREATE TABLE frames("simID" INT, "data" BLOB)')
data.bin <-
2018 Nov 07
2
error unserializing ascii format (v2 or v3)
I ran into an interesting error unserializing a file created with
ascii=TRUE:
R 3.5.1 (Windows or Linux):
> unserialize(serialize(list(raw=as.raw(c(39,41))), NULL, version=2,
ascii=TRUE))
Error in unserialize(serialize(list(raw = as.raw(c(39, 41))), NULL,
version = 2, :
ReadItem: unknown type 29, perhaps written by later version of R
The same error happens when the
2011 Dec 06
1
unserialize and eager execution
Hi,
While debugging a network server I'm developing I noticed something unusual
- call to unserialize() resulted in
an error about loading a namespace.
I was a bit taken back by this - why should unserializing an object cause a
namespace lookup?
Are there any other side-effects of unserialize() that I should be cautious
about? I've been
digging through the R_Unserialize() call, I
2020 Oct 29
2
Something is wrong with the unserialize function
Hi all,
I am not able to export an ALTREP object when `gctorture` is on in the
worker. The package simplemmap can be used to reproduce the problem. See
the example below
```
## Create a temporary file
filePath <- tempfile()
con <- file(filePath, "wrb")
writeBin(rep(0.0,10),con)
close(con)
library(simplemmap)
library(parallel)
cl <- makeCluster(1)
x <- mmap(filePath,
2018 Jun 21
1
DOCUMENTATION(?): parallel::mcparallel() gives various types of "Error in unserialize(r) : ..." errors if value is of type raw
I stumbled upon the following:
f <- parallel::mcparallel(raw(0L))
parallel::mccollect(f)
# $`77083`
# NULL
but
f <- parallel::mcparallel(raw(1L))
parallel::mccollect(f)
# Error in unserialize(r) : read error
traceback()
# 2: unserialize(r)
# 1: parallel::mccollect(f)
(restarting because the above appears to corrupt the R session)
f <- parallel::mcparallel(raw(2L))
2012 Nov 04
1
what is the function naming convention?
Dear R people,
In typing names of functions (built in or from a package) I often guess wrong, and have to look the name up.
In other words, I don't understand the logic in naming functions (if there is any):
- most names are plain, lower case: cos, plot, sapply, t, toupper, unserialize, (etc)
- some are capitalized: Filter, Machine, Map, NCOL, RNGversion, T (etc)
-
2020 Oct 29
2
[External] Something is wrong with the unserialize function
This
Index: src/main/altrep.c
===================================================================
--- src/main/altrep.c (revision 79385)
+++ src/main/altrep.c (working copy)
@@ -275,10 +275,11 @@
SEXP psym = ALTREP_SERIALIZED_CLASS_PKGSYM(info);
SEXP class = LookupClass(csym, psym);
if (class == NULL) {
- SEXP pname = ScalarString(PRINTNAME(psym));
+ SEXP pname =
2010 Jul 17
1
bug in identical()? [Was: [R-sig-ME] Failure to load lme4 on Mac]
Daniel,
thanks for the test case. I did run it in valgrind but nothing showed up, however ...
I'm starting to have a suspicion that this has something to do with identical() - look at this:
> identical(M1,M2)
[1] FALSE
> all(serialize(M1,NULL)==serialize(M2,NULL))
[1] TRUE
> identical(unserialize(serialize(M1,NULL)),unserialize(serialize(M2,NULL)))
[1] FALSE
>
2006 Sep 05
1
serialize changes for 2.4.0
I noticed today that in R 2.3.1, I get
> serialize(list(1,2,3), NULL, ascii = TRUE)
[1] "A\n2\n131841\n131840\n19\n3\n14\n1\n1\n14\n1\n2\n14\n1\n3\n"
>
but in R 2.4.0 alpha I get
> serialize(list(1,2,3), NULL, ascii = TRUE)
[1] 41 0a 32 0a 31 33 32 30 39 36 0a 31 33 31 38 34 30 0a 31 39 0a 33 0a 31 34
[26] 0a 31 0a 31 0a 31 34 0a 31 0a 32 0a 31 34 0a 31 0a 33 0a
>
2011 Sep 28
1
serialize/unserialize vector improvement
Hi folks,
I've attached a patch to the svn trunk that improves the performance
of the serialize/unserialize interface for vector types. The current
implementation: a) invokes the R_XDREncode operation for each element
of the vector type, and b) uses a switch statement to determine the
stream type for each element of the vector type. I've added
R_XDREncodeVector/R_XDRDecodeVector functions
2008 Nov 30
1
Rserve and creating a list of lists
Hello,
I have some code which generates lattice objects. The function
recieves serialized forms of the lattice objects which it then
unserializes and then adds to an ArrayList<REXP>.
REXPRaw rser = new REXPRaw( target ); //target contains the raw
serialized forms of lattice objects
rconn.assign("temp",rser);
REXP ret =
2006 Feb 08
1
corruption of data with serialize(ascii=TRUE)
I noticed the following peculiarity with `serialize()' when `ascii = TRUE' is
used. In today's (svn r37299) R-devel, I get
> set.seed(10)
> x <- rnorm(10)
>
> a <- serialize(x, con = NULL, ascii = TRUE)
> b <- unserialize(a)
>
> identical(x, b) ## FALSE
[1] FALSE
> x - b
[1] -3.469447e-18 2.775558e-17 -4.440892e-16 0.000000e+00
2015 Mar 25
2
nested parallel workers
Hi Simon,
I'm having trouble with nested parallel workers, specifically, forking
inside socket connections.
When mclapply is called inside a SOCK, PSOCK or FORK worker I get an
error in unserialize().
cl <- makeCluster(1, "SOCK")
fun = function(i) {
library(parallel)
mclapply(1:2, sqrt)
}
Failure occurs after multiple calls to clusterApply:
> clusterApply(cl, 1,
2005 Dec 12
2
Can you unserialize an object from the db?
I don''t even know if this is possible. I want to use an object as an
attribute for one of my classes. I can save it to the db fine, looks
like...but I need to be able to use it after I pull the object from
the db. Right now the attribute is just a String, but I need it to be
a Runt::Intersect object. Does anyone know how I can unserialize the
attribute so I can use it as an object?
2015 Mar 30
2
nested parallel workers
On 03/25/2015 07:48 PM, Simon Urbanek wrote:
> On Mar 25, 2015, at 3:46 PM, Valerie Obenchain <vobencha at fredhutch.org> wrote:
>
>> Hi Simon,
>>
>> I'm having trouble with nested parallel workers, specifically, forking inside socket connections.
>>
>
> You simply can't by definition - when you fork *all* the workers share the same connection
2012 Aug 31
3
Arrays Partial unserialization
Hi all,
I'm working with some huge array in R and I need to load several ones to
apply some functions that requires to have all my arrays values for each
cell...
To make it possible, I would like to load only a part (for example 100
cells) of all my arrays, apply my function, delete all cells loaded,
loaded following cells and so on.
Is it possible to unserialize (or load) only a
2006 Jul 09
2
serialized DateTime objects returning as Time objects
I have a database field called dates in which I am trying to serialize an
array of DateTime objects. When I unserialize them, they are coming back
in as Time objects. I know this, because I am getting errors that say
"comparison between Time and DateTime failed.
Why is this happening? Is there a way to prevent it??
Thanks Shelby
-------------- next part --------------
An HTML attachment
2007 Aug 23
3
RData File Specification?
Hi,
I am developing a tool for converting a large data frame stored in an uncompressed binary (XDR) RData file to a delimited text file. The data frame is too large to load() and extract rows from on a typical PC. I'm looking to parse through the file and extract individual entries without loading the whole thing into memory.
In terms of some C source functions, instead of doing
2012 Mar 22
1
Serializing many small objects efficiently
Hi,
sorry if this question is trivial or unclear, this is my first venture into
mixed C/R programming (I am reasonably experienced in each separately).
I am trying to write a serialization function for a format called
typedbytes, which is used as an interchange format in Hadoop circles. Since
I would need to serialize according to the internal R format many small R
objects I looked at the c
2004 Apr 08
2
socket clusters on snow dies easily
hello,
I'm using R 1.8.1 with the lastest snow package on FreeBSD 4.9.
However, when I try to using socket clusters, it's very unstable.
Sometimes it dies half way when I run parSapply(), sometimes
it dies when cluster connection is idle.
I create a socket cluster by following cmd
cl = makeCluster("foo", type = "SOCK", outfile="/tmp/rafanlog");