search for: saverds

Displaying 20 results from an estimated 127 matches for "saverds".

Did you mean: saved
2018 Feb 07
1
saveRDS() overwrites file when object is not found
I ran into this behaviour when accidentally running a line of code that I shouldn't have. When saving over an rds with an object that's not found, I would have expected saveRDS to not touch the file. saveRDS(iris, "test.rds") file.size("test.rds") #> [1] 1080 saveRDS(no_object_here, "test.rds") #> Error in saveRDS(no_object_here, "test.rds"): object 'no_object_here' not found file.size("test.rds") #> [1]...
2013 Jun 25
5
How can C++ read the R object written into socket with saveRDS or save
Hi, all, Recently, I met one issue when using socket between R & C++ to transmit R object. Would you pls help give me some suggestions? Many thanks! [Background]: I create a socket connection between R & C++ binary first, and then, want to use saveRDS() or save() in R to save the object into connection directly. So that the C++ binary can read the object, and send it to another remote R. [What I did so far]: 1. I used socketConnection in R and listen/accept in C++, to establish one blocking socket. 2. I used saveRDS to save the R object into so...
2013 Jun 25
5
How can C++ read the R object written into socket with saveRDS or save
Hi, all, Recently, I met one issue when using socket between R & C++ to transmit R object. Would you pls help give me some suggestions? Many thanks! [Background]: I create a socket connection between R & C++ binary first, and then, want to use saveRDS() or save() in R to save the object into connection directly. So that the C++ binary can read the object, and send it to another remote R. [What I did so far]: 1. I used socketConnection in R and listen/accept in C++, to establish one blocking socket. 2. I used saveRDS to save the R object into so...
2011 Oct 18
9
readRDS and saveRDS
Hi all, Is there any chance that readRDS and saveRDS might one day become read.rds and write.rds? That would make them more consistent with the other reading and writing functions. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
2018 Apr 02
3
recordPlot/replayPlot not working with saveRDS/readRDS
The documentation for recordPlot says the following: > As of R 3.3.0, it is possible (again) to replay a plot from another R session using, for example, saveRDS and readRDS. However, I haven't been able to save and restore a plot displaylist and have it work within the same R session, using R 3.4.3 or 3.3.3. Here's an example: # Save displaylist for a simple plot png('test.png') dev.control(displaylist ="enable") plot(1:5, 1:5)...
2018 Apr 03
1
[FORGED] recordPlot/replayPlot not working with saveRDS/readRDS
>>>>> Paul Murrell <paul at stat.auckland.ac.nz> >>>>> on Tue, 3 Apr 2018 09:41:56 +1200 writes: > Hi What you are doing "wrong" is loading a recordedplot > into the same session that it was created in. The > saveRDS()/readRDS() works if you save in one R session and > then read in a different R session. The assumption is > that if you are still in the same session that created the > recordedplot you still have the recordedplot (e.g., you > can just do replayPlot(r) instead of repla...
2018 Apr 02
0
[FORGED] recordPlot/replayPlot not working with saveRDS/readRDS
Hi What you are doing "wrong" is loading a recordedplot into the same session that it was created in. The saveRDS()/readRDS() works if you save in one R session and then read in a different R session. The assumption is that if you are still in the same session that created the recordedplot you still have the recordedplot (e.g., you can just do replayPlot(r) instead of replayPlot(r2). Is that a bad assump...
2023 Nov 15
1
saveRDS()/readRDS() on environments
Dear r-devel, I was surprised to see that saveRDS() and readRDS() work quite well with environments, see below: ``` z <- 3 # in global env y <- new.env() y$a <- 1 x <- new.env(parent = y) x$b <- 2 saveRDS(x, "x.RDS") # in a new session x <- readRDS("x.RDS") y <- parent.env(x) x$b #> [1] 2 y$a #> [1]...
2012 Sep 15
2
Risk of readRDS() not detecting race conditions with parallel saveRDS()?
...format used in (non-compressed) serialization/RDS, but hoping someone with more knowledge could give me some feedback; Consider two R processes running in parallel on the same unknown file system. Both of them write and read to the same RDS file foo.rds (without compression) at random times using saveRDS(object, file="foo.rds", compress=FALSE) and object2 <- readRDS(file="foo.rds"). This happens frequently enough such that there is a risk for the two processes to write to the same "foo.rds" file at the same time (here one needs to acknowledge that file updates are...
2020 Jan 29
2
Model object, when generated in a function, saves entire environment when saved
...ile when saving RDS's which is great. However, I noticed the problem again when saving `qs` files (https://github.com/traversc/qs) which is an RDS replacement with a fast serialization / compression system. I'd like to get an idea of what change was made within R to address this issue for `saveRDS`. My thought is that this will help the author of the `qs` package do something similar. I have had a browse through the release notes for the last few years (Ctrl-F-ing "environment") and couldn't see it. Many thanks for any help and best wishes to all. The following code uses R 3....
2012 Apr 17
4
parallel processing with multiple directories
...ss. The error I get is: "Error in setwd(x) : cannot change working directory" library(parallel) dirs <- list("out1","out2","out3") # these directories are located within the current working directory temp <- 1:3 testF <- function(x) { setwd(x) saveRDS(temp,"temp.drs") } mclapply(dirs, testF) Any help would be appreciated! --David ********************************************* David R. Schaefer, Ph.D. Assistant Professor School of Social and Family Dynamics Arizona State University www.public.asu.edu/~schaef/
2012 Jan 09
1
serializing recordedplot object
...k that I render later to a variety of formats. This works fine for base R plots and ggplot2 plots, and also used to work for lattice plots. However somewhere in version 2.14 things stopped working for lattice plots. Here is an example: library(lattice); histogram(rnorm(100)); x <- recordPlot(); saveRDS(x, "myplot.rds"); y <- readRDS("myplot.rds"); print(y); Error: NULL value passed as symbol address printing x works fine, but printing y either gives an error or prints an empty page. The problem seems to be related to serializing the recordedplot object, which contains a lo...
2006 Feb 08
1
corruption of data with serialize(ascii=TRUE)
...00000e+00 2.220446e-16 -5.551115e-17 I expected `x' and `b' to be identical, which is what I get when `ascii = FALSE': > a <- serialize(x, con = NULL, ascii = FALSE) > b <- unserialize(a) > > identical(x, b) ## TRUE [1] TRUE The same phenomenon occurs with `.saveRDS(ascii = TRUE)', > .saveRDS(x, file = "asdf", ascii = TRUE) > d <- .readRDS("asdf") > > identical(x, d) ## FALSE [1] FALSE > Has anyone noticed this before? I didn't see anything in the docs for `serialize()' that would indicate this behavi...
2015 Jan 15
0
Request to speed up save()
In addition to the major points that others made: if you care about speed, don't use compression. With today's fast disks it's an order of magnitude slower to use compression: > d=lapply(1:10, function(x) as.integer(rnorm(1e7))) > system.time(saveRDS(d, file="test.rds.gz")) user system elapsed 17.210 0.148 17.397 > system.time(saveRDS(d, file="test.rds", compress=F)) user system elapsed 0.482 0.355 0.929 The above example is intentionally well compressible, in real life the differences are actually...
2012 Jun 19
1
Reference classes and memory consumption
...imal class uses about 20K on disk. rm(list=ls(all=TRUE)); MySmallClass = setRefClass("MySmallClass", fields = list( myField = "numeric" ), methods = list( initialize = function(f) { myField <<- f; }) ); o = MySmallClass$new(10); saveRDS(o, file="C:\\o.rds"); file.info("C:\\o.rds")$size; Result: [1] 21274 My questions: Is saveRDS() is representative for memory usage? If so, is there a way to shrink these objects to a smaller size? I use R 2.15.0 on a 32 Bit Windows 7 system. Best regards, Jan
2015 Jan 15
4
Request to speed up save()
Hi, I am dealing with very large datasets and it takes a long time to save a workspace image. The options to save compressed data are: "gzip", "bzip2" or "xz", the default being gzip. I wonder if it's possible to include the pbzip2 (http://compression.ca/pbzip2/) algorithm as an option when saving. "PBZIP2 is a parallel implementation of the bzip2
2018 Mar 29
2
Base R examples that write to current working directory
Hi all, Given the recent CRAN push to prevent examples writing to the working directory, is there any interest in fixing base R examples that write to the working directory? A few candidates are the graphics devices, file.create(), writeBin(), writeChar(), write(), and saveRDS(). I'm sure there are many more. One way to catch these naughty examples would be to search for unlink() in examples: e.g., https://github.com/wch/r-source/search?utf8=?&q=unlink+extension%3ARd&type=. Of course, simply cleaning up after yourself is not sufficient because if those files...
2018 Jan 10
2
R CMD build then check fails on R-devel due to serialization version
...nder development (unstable) (2018-01-09 r74100)) for multiple packages: * checking serialized R objects in the sources ... WARNING Found file(s) with version 3 serialization: ?build/vignette.rds? Such files are only readable in R >= 3.5.0. Recreate them with R < 3.5.0 or save(version = 2) or saveRDS(version = 2) as appropriate As far as I can tell, revision 74099 (https://github.com/wch/r-source/commit/d9530001046a582ff6a43ca834d6c3586abd0a97), which changes the default serialization format to 3, clashes with revision 73973 (https://github.com/wch/r-source/commit/885764eb74f2211a547b13727f2ec...
2018 Mar 30
2
Base R examples that write to current working directory
...; >> Given the recent CRAN push to prevent examples writing to the working >> directory, is there any interest in fixing base R examples that write >> to the working directory? A few candidates are the graphics devices, >> file.create(), writeBin(), writeChar(), write(), and saveRDS(). I'm >> sure there are many more. >> >> One way to catch these naughty examples would be to search for >> unlink() in examples: e.g., >> https://github.com/wch/r-source/search?utf8=?&q=unlink+extension%3ARd&type=. >> >> Of course, simply clea...
2020 Feb 29
3
dput()
...are output using format ?"%.17g"? which may give more precision than the default (but the output will depend on the platform and there may be loss of precision when read back). ... but this still doesn't guarantee that all precision is kept. Maybe saveRDS(x,textConnection("out","w"),ascii=TRUE) identical(x,as.numeric(out[length(out)])) ## TRUE ? On 2020-02-29 2:42 a.m., Rui Barradas wrote: > Hello, > > FAQ 7.31 > > See also this StackOverflow post: > > https://stackoverflow.com/questions/9508518/why...