search for: pryr

Displaying 20 results from an estimated 20 matches for "pryr".

Did you mean: pry
2017 Nov 01
2
Memory address of character datatype
Hi, ? To get the memory address of where the value of variable "x" (of datatype "numeric") is stored one does the following in R (in 32 bit): ? ??? ? library(pryr) ? ?? ?x <- 1024 ?? ?? addr <- as.numeric(address(x)) +?24?? ?# 24 is needed to jump the variable info and point to the data itself (i.e. 1024) ? The question now is what is the value of the jump?so that one can?obtain the memory address of where the value of variable "x" (of dataty...
2020 Mar 27
1
object.size vs lobstr::obj_size
...> > #> * 719,232 B > > #> * ? ? 720 B > > lobstr::obj_sizes(A, new("A", stuff=runif(1e8))) > > #> * ? ? 719,232 B > > #> * 800,000,720 B > > Nice. Can you clarify the situation with lobstr::obj_size vs > pryr::object_size? I've heard of the latter before and use it sometimes > but never heard of the former before seeing Stefan's post. Then I > checked the authors of both and thought maybe they should talk to each > other ;-) > > > pryr is basically retired :) TBH...
2020 Mar 27
2
object.size vs lobstr::obj_size
...t; 719,232 B > lobstr::obj_sizes(A, new("A", stuff=raw(0))) > #> * 719,232 B > #> * ? ? 720 B > lobstr::obj_sizes(A, new("A", stuff=runif(1e8))) > #> * ? ? 719,232 B > #> * 800,000,720 B Nice. Can you clarify the situation with lobstr::obj_size vs pryr::object_size? I've heard of the latter before and use it sometimes but never heard of the former before seeing Stefan's post. Then I checked the authors of both and thought maybe they should talk to each other ;-) Thanks, H. > > Hadley > -- > http://hadley.nz > <ht...
2017 Nov 12
1
Array changing address unexpectedly
Hi David, ? Thanks for the correction concerning the "else" issue. ? Taking your code and removing some lines (to increase readability): ? library(pryr) ? data <- array(dim = c(5)) for(x in 1:5) { ?? data[x] <- as.integer(x * 2) } ? #print(data) ? add = address(data) for(x in 1:5) { ?? data[x] <- as.integer(0) } ? if (add == address(data)) { print("Address did not change") } else { print("Address changed") } ? ? If one...
2017 Nov 12
2
Array changing address unexpectedly
Hi, Given the following R code: library(pryr) data <- array(dim = c(5)) for(x in 1:5) { data[x] <- as.integer(x * 2) } add = address(data) # save address of "data" for(x in 1:5) { data[x] <- as.integer(0) } if (add == address(data)) { print(&...
2018 May 13
1
different type of modification when code is sourced and pasted
...R's modification in place and replacement functions. I was working through Hadley Wickham's Advanced R section on Replacement Functions and in a file (say test.R) I wrote: `second<-` <- function(x, value) { x[2] <- value x } x <- 1:10 second(x) <- 5L print(x) library(pryr) x <- 1:10 print(address(x)) second(x) <- 6L print(address(x)) x <- 1:10 print(address(x)) x[2] <- 7L print(address(x)) When I copy-paste the code the effect is as expected: > `second<-` <- function(x, value) { + x[2] <- value + x + } > x <- 1:10 > second(x)...
2017 Nov 02
0
Memory address of character datatype
...e APIs allow us to change details of the memory layout between svn versions or even as the program executes (altrep), in order to save memory or improve performance. Also, it means that the layout can be slightly different between platforms, e.g. 32-bit vs 64-bit. Unfortunately address(x) from pryr bypasses the APIs - you should never use address(x) in your programs and I wish address(x) did not exist. If you had a concrete problem at hand you wanted to solve with "address(x)", feel free to ask for a viable solution. Best Tomas On 11/01/2017 07:37 PM, lille stor wrote: >...
2020 Mar 27
0
object.size vs lobstr::obj_size
...new("A", stuff=raw(0))) > > #> * 719,232 B > > #> * 720 B > > lobstr::obj_sizes(A, new("A", stuff=runif(1e8))) > > #> * 719,232 B > > #> * 800,000,720 B > > Nice. Can you clarify the situation with lobstr::obj_size vs > pryr::object_size? I've heard of the latter before and use it sometimes > but never heard of the former before seeing Stefan's post. Then I > checked the authors of both and thought maybe they should talk to each > other ;-) > pryr is basically retired :) TBH I don't know why I...
2017 Jun 12
2
Possible with enableJIT function
...on he has experienced continuously increasing memory usage by package nleqslv leading to an out of memory condition. I have been able to reproduce the continuously increasing memory usage with the following small example. <code> library(nleqslv,lib.loc="../nleqslv.Rcheck") library(pryr) dslnex <- function(x) { y <- numeric(2) y[1] <- x[1]^2 + x[2]^2 - 2 y[2] <- exp(x[1]-1) + x[2]^3 - 2 y } xstart <- c(x1=1.5,x2=2) nsims <- 10 for(test_iter in seq_len(nsims)){ z <- nleqslv(xstart,dslnex,jacobian=NULL) print(paste("nleqslv iteration...
2017 Jul 31
0
force promises inside lapply
...tly) suppressPackageStartupMessages else `{` >> wrapper(library(package = package, character.only=TRUE)) >> } >> >> > lapply(c("MASS","boot"), myLoader, quietly=FALSE) >> [[1]] >> [1] "MASS" "splines" "pryr" "stats" "graphics" "grDevices" >> [7] "utils" "datasets" "methods" "base" >> >> [[2]] >> [1] "boot" "MASS" "splines" "pryr" &qu...
2017 Sep 08
1
Change of variable address due to GC
Hi, ? I would like to know if the Garbage Collector (GC) changes the address of a variable in R. In other words, assuming the following code: ? ??? ? library(pryr) ? ? ??? x <- 1:1024 ? ??? ? addr <- address(x)? # save address of variable "x" in "addr" ??????? ? . ?? ????? ? . ???? ??? ? . ????? (execution of operations that create/destroy many small/big objects in memory, which will likely make the GC to be called) ?????...
2017 Nov 12
0
Array changing address unexpectedly
> On Nov 12, 2017, at 8:47 AM, lille stor <lille.stor at gmx.com> wrote: > > Hi, > > Given the following R code: > > library(pryr) > > data <- array(dim = c(5)) > > for(x in 1:5) > { > data[x] <- as.integer(x * 2) > } > > add = address(data) # save address of "data" > > for(x in 1:5) > { > data[x] <- as.integer(0) >...
2017 Jun 13
0
Possible with enableJIT function
...y increasing memory usage > by package nleqslv leading to an out of memory condition. > > I have been able to reproduce the continuously increasing memory usage with the following small example. > > <code> > library(nleqslv,lib.loc="../nleqslv.Rcheck") > library(pryr) > dslnex <- function(x) { > y <- numeric(2) > y[1] <- x[1]^2 + x[2]^2 - 2 > y[2] <- exp(x[1]-1) + x[2]^3 - 2 > y > } > xstart <- c(x1=1.5,x2=2) > nsims <- 10 > for(test_iter in seq_len(nsims)){ > z <- nleqslv(xstart,dslnex,jacobian=...
2017 Nov 22
2
function pointers?
We have a project that calls for the creation of a list of many distribution objects. Distributions can be of various types, with various parameters, but we ran into some problems. I started testing on a simple list of rnorm-based objects. I was a little surprised at the RAM storage requirements, here's an example: N <- 10000 closureList <- vector("list", N) nsize = sample(x
2015 Sep 29
3
making object.size() more meaningful on environments?
Hi, Currently object.size() is not very useful on environments as it always returns 56 bytes, no matter how big the environment is: env1 <- new.env() object.size(env1) # 56 bytes env2 <- new.env(hash=TRUE, size=75000000L) object.size(env2) # 56 bytes env3 <- list2env(list(a=runif(25000000), L=LETTERS)) object.size(env3) # 56 bytes This makes it pretty useless on
2018 Jan 04
0
Coping with non-standard evaluation in R program analysis
Evan, The pryr package provides some utilities which may be handy here. In particular see the function: is_promise. Also, next time please post in plaintext. Regards Ben > Hello R experts, > > > I plan to develop a tool for dynamic analysis of R programs. I would like to trace function calls at run...
2020 Oct 02
1
What is the threshold for `useRaster` of graphics::image()?
Hi R-help list What is the threshold for the `useRaster` argument of graphics::image() to decide whether a grid is "regular" or not (i.e. the usage of useRaster=T is allowed or not). My `dev.capabilities("rasterImage")$rasterImage` is "yes". I could not find this information in the internet. I also could not find the source code of the graphics::image() function (I
2016 Feb 11
2
inconsistency in treatment of USE.NAMES argument
...R:106 /mime/R/mime.R:129 /packrat/R/bundle.R:137 /packrat/R/hooks.R:45 /packrat/R/lockfile.R:56 /pixiedust/R/sprinkle_colnames.R:66 /plyr/R/id.r:38 /polyCub/R/polyCub.SV.R:110 /polyCub/R/polyCub.exact.Gauss.R:99 /polyCub/R/polyCub.iso.R:130 /polyCub/R/polyCub.iso.R:166 /polyCub/R/polyCub.iso.R:168 /pryr/R/dots.r:25 /rappdirs/R/utils.r:39 /rbison/R/bison.R:181 /rcrossref/R/cr_ft_text.R:191 /rcrossref/R/get_styles.R:16 /rebus.base/R/internal.R:29 /rerddap/R/info.R:73 /rerddap/R/info.R:80 /rerddap/R/search.R:37 /rerddap/R/search_adv.R:64 /reutils/R/ecitmatch.R:33 /reutils/R/parse-docsum.R:53 /reutils...
2020 Mar 27
4
object.size vs lobstr::obj_size
Hi Tomas, On 3/27/20 07:01, Tomas Kalibera wrote: > they provide an over-approximation They can also provide an "under-approximation" (to say the least) e.g. on reference objects where the entire substance of the object is ignored which makes object.size() completely meaningless in that case: setRefClass("A", fields=c(stuff="ANY"))
2016 Feb 08
2
inconsistency in treatment of USE.NAMES argument
Hi, Both vapply() and sapply() support the 'USE.NAMES' argument. According to the man page: USE.NAMES: logical; if ?TRUE? and if ?X? is character, use ?X? as ?names? for the result unless it had names already. But if 'X' has names already and 'USE.NAMES' is FALSE, it's not clear what will happen to the names. Are they going to propagate to the result