Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

inspect

Inspect internal attributes of R objects.


Description

typename determines the internal C typename, address returns the memory location of the object, and refs returns the number of references pointing to the underlying object.

Usage

sexp_type(x)

inspect(x, env = parent.frame())

refs(x)

address(x)

typename(x)

Arguments

x

name of object to inspect. This can not be a value.

env

When inspecting environments, don't go past this one.

Non-standard evaluation

All functions uses non-standard evaluation to capture the symbol you are referring to and the environment in which it lives. This means that you can not call any of these functions on objects created in the function call. All the underlying C level functions use Rf_findVar to get to the underlying SEXP.

See Also

Other object inspection: ftype, otype

Examples

x <- 1:10
## Not run: .Internal(inspect(x))

typename(x)
refs(x)
address(x)

y <- 1L
typename(y)
z <- list(1:10)
typename(z)
delayedAssign("a", 1 + 2)
typename(a)
a
typename(a)

x <- 1:5
address(x)
x[1] <- 3L
address(x)

pryr

Tools for Computing on the Language

v0.1.4
GPL-2
Authors
Hadley Wickham [aut, cre], R Core team [ctb] (Some code extracted from base R)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.