search for: qsave

Displaying 4 results from an estimated 4 matches for "qsave".

Did you mean: save
2020 Jan 29
2
Model object, when generated in a function, saves entire environment when saved
...nment") and couldn't see it. Many thanks for any help and best wishes to all. The following code uses R 3.6.2 and requires you to run install.packages("qs") first: save_size_qs <- function (object) { tf <- tempfile(fileext = ".qs") on.exit(unlink(tf)) qs::qsave(object, file = tf) file.size(tf) } save_size_rds <- function (object) { tf <- tempfile(fileext = ".rds") on.exit(unlink(tf)) saveRDS(object, file = tf) file.size(tf) } normal_lm <- function(){ junk <- 1:1e+08 lm(Sepal.Length ~ Sepal.Width, data = iris) } norma...
2001 Jan 17
4
Can one set --no-save in .Rprofile
(On Unix/Linux) Is it possible to set the --no-save command line option as an option in the .Rprofile file. I have looked in the sources and do not see any obvious (user initiated) ways of changing the command line defaults, but I am hoping I have missed something. I *know* I can write my own shell script wrapper that calls R with whatever arguments I want (and I do that). However there
2020 Jan 29
0
Model object, when generated in a function, saves entire environment when saved
...hrough the release > notes for the last few years (Ctrl-F-ing "environment") and couldn't see it. The vector 1:1e+08 is stored very compactly in recent R versions (the start and end plus a marker that it's a sequence), and it appears saveRDS takes advantage of that while qs::qsave doesn't. That's not a very useful test, because environments typically aren't filled with long sequence vectors. If you replace the line junk <- 1:1e+08 with junk <- runif(1e+08) you'll see drastically different results: > save_size_qs(normal_lm()) [1] 41795...
2016 Jul 27
2
Model object, when generated in a function, saves entire environment when saved
Another solution is to only save the parts of the model object that interest you. As long as they don't include the formula (which is what drags along the environment it was created in), you will save space. E.g., tfun2 <- function(subset) { junk <- 1:1e6 list(subset=subset, lm(Sepal.Length ~ Sepal.Width, data=iris, subset=subset)$coef) } saveSize(tfun2(1:4)) #[1] 152 Bill