Skip to content
Back to skills

Pryr

ASecurity

R pryr package for R internals. Use for exploring R's internal workings and memory usage.

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 4, 2026
dataexpressperformance

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill pryr --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pryr?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pryr
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-pryr/badge)](https://www.skillsdirectory.com/skills/leolin990405-pryr)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pryr
description: R pryr package for R internals. Use for exploring R's internal workings and memory usage.
---

# pryr

Tools for computing on the language.

## Object Information

```r
library(pryr)

# Object size
object_size(x)
object_size(x, y)  # Combined size

# Compare sizes
compare_size(x, y)

# Memory address
address(x)

# References to object
refs(x)
```

## Memory Tracking

```r
# Track memory changes
mem_used()

# Memory change from expression
mem_change(x <- 1:1e6)

# Track allocations
track_copy(x)
```

## Object Types

```r
# Type of object
otype(x)  # base, S3, S4, RC, R6

# Is object...
is_s3_generic(f)
is_s3_method(f)

# Function type
ftype(f)  # primitive, internal, closure, special
```

## Environments

```r
# Where is object defined
where("mean")

# Parent environments
parenvs(e)

# Environment as list
env2list(e)
```

## Function Inspection

```r
# Function body
body(f)

# Function arguments
fargs(f)

# Function environment
environment(f)

# Unenclose function
unenclose(f)
```

## Promises

```r
# Check if promise
is_promise(x)

# Promise info
promise_info(x)
```

## Calls and Expressions

```r
# Standardize call
standardise_call(quote(mean(x, na.rm = TRUE)))

# Modify call
modify_call(call, new_args)

# Call tree
call_tree(quote(f(g(x), h(y))))
```

## Active Bindings

```r
# Create active binding
make_active_binding("x", function() runif(1), .GlobalEnv)

# Check if active binding
is_active_binding("x")
```

## Partial Application

```r
# Partial function application
f <- function(x, y, z) x + y + z
g <- partial(f, x = 1)
g(y = 2, z = 3)  # Returns 6

# With dots
h <- partial(f, x = 1, .lazy = FALSE)
```

## Composition

```r
# Compose functions
f <- function(x) x + 1
g <- function(x) x * 2

fg <- compose(f, g)  # f(g(x))
fg(5)  # Returns 11
```

## Substitution

```r
# Substitute in expression
subs(x + y, list(x = 1))

# Substitute with quoting
subs_q(x + y, list(x = quote(a)))
```

## Bytecode

```r
# Check if bytecode compiled
is_bytecode(f)

# Disassemble bytecode
disassemble(f)
```

## Performance

```r
# Compare object sizes
object_size(1:1000)
object_size(as.numeric(1:1000))

# Memory efficient operations
# Use pryr to understand memory behavior
x <- 1:1e6
address(x)
x[1] <- 0L
address(x)  # Same address (modify in place)

y <- x
address(y)  # Same address (copy on modify)
y[1] <- 1L
address(y)  # Different address (copied)
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.