R: Inspect internal attributes of R objects.

sexp_type {pryr} | R Documentation

## 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)

[Package pryr version 0.1.4 Index]