pryr provides tools to pry back the covers of R and understand the language at a deeper level. It has been developed in conjunction with "Advanced R programming" to make it easier to understand what's going on in R.
Questions tagged [pryr]
26 questions
1
vote
0 answers
Why modelling in R consumes more memory than the returned object
When performing survival analysis in R, fitting a model is reported to consume more memory, than the actual object being returned. Moreover, this seems to happen only a few times, not for every…

mjktfw
- 840
- 6
- 14
1
vote
1 answer
what is the object type of mean in R?
I am looking for the real object type of some functions in R, for example, I can not find out the object type of mean function.
> library(pryr)
> otype(mean)
[1] "base"
> ftype(mean)
[1] "s3" "generic"
Sometimes the mean function is S3 and…

Shahab Einabadi
- 307
- 4
- 15
1
vote
2 answers
How can I parse and modify an R expression, possibly using non-standard evaluation?
I'd like to parse an R expression into a list and optionally modify aspects of it before finally turning it into a json object. As an example, I'm trying to get to something like:
{"op": "=",
"content": {
"lhs": "gender",
…

seandavi
- 2,818
- 4
- 25
- 52
1
vote
2 answers
Compose functions with function operators does not work as expected
In the following example I created the add_timing function operator. The input is a function (say mean) and it returns a function that does the same as mean, but reports on how long it took for the function to complete. See the following…

Paul Hiemstra
- 59,984
- 12
- 142
- 149
0
votes
0 answers
R Shiny removing module inputs and observers doesn't seem to reduce memory usage
Following Jonas Hag's example for destroying observe events in order to recover memory during a session, I've added code to check memory usage using pryr.
Each time a module is removed, mem_change() is negative, which seems to indicate memory is…

Vlad
- 3,058
- 4
- 25
- 53
0
votes
4 answers
substitute LHS in `=` operator with rlang tidyeval inside Sys.setenv
Problem description
Sys.setenv does not have an easy interface to supply LHS (the env var name) as a parameter. If one wants to dynamically define what env var should be set, then metaprogramming approach is required.
Base R way
This small helper…

jangorecki
- 16,384
- 4
- 79
- 160
0
votes
1 answer
library(pryr) returns a message. Registered S3 method overwritten by 'pryr': method from print.bytes Rcpp
When I active a package called pryr. It returns a message
library(pryr)
Registered S3 method overwritten by 'pryr':
method from
print.bytes Rcpp.
I would like to know what does it is mean?
However the package runs properly.…

Kamalesh Barai
- 47
- 1
- 6
0
votes
1 answer
Fix survival() environment "Error in is.data.frame" error using pryr or other tidyverse tools
I am struggling to find an elegant resolution for an environment issue that I continually run into using the survival library in R. Here is a toy example of the problem I am having:
# Make a fake data set
set.seed(1)
BigData <- cbind(rexp(100, .3),…

user9371378
- 1
- 1
0
votes
1 answer
object is masked by GlobalEnv error
I have installed package pryr in my R studio and now trying to import the same, using
library(pryr)
Getting the error as :
Attaching package: ‘pryr’
The following object is masked _by_ ‘.GlobalEnv’:
f
What shall be done, so that I can…

Sarang Manjrekar
- 1,839
- 5
- 31
- 61
0
votes
0 answers
R memory usage not decreasing after clearing workspace
I ran a large amount of calculations in R (using RStudio) and I'm confused about the state that this has left R in. Specifically, after I ran
rm(list=ls(all.names = T))
and then
mem_used()
I am seeing that around 400 megabytes of space is being…

chuck taylor
- 2,476
- 5
- 29
- 46
-1
votes
1 answer
`Advanced R` book: Find all environments containing a binding for `name`
In the book, the exercise is on page 10/23 of the Environments chapter, after section Iteration vs. Recursion. It is
Modify where() to find all environments that contain a binding for
name.
Here, where() is from the pryr package. First of all,…

TMOTTM
- 3,286
- 6
- 32
- 63