R | Inspecting object internals
R has a (not well undocumented) function that allows one to inspect some internal information of objects, which can be useful for debugging.
This is the form:
.Internal(inspect(x, max.depth=-1, max.elements=5))
This will display information about x
, typically in a nested fashion for composite values.
max.depth
is the maximum nesting depth level that will be displayed; setting-1
will display all levelsmax.elements
is the maximum number of elements per level that will be displayed; any element after that will not be printed out
Example Output:
> .Internal(inspect(c("foo", "bar")))
@7fafbe061708 16 STRSXP g0c2 [] (len=2, tl=0)
@7fafb61d46e0 09 CHARSXP g1c1 [MARK,gp=0x61,ATT] [ASCII] [cached] "foo"
@7fafb8e7d100 09 CHARSXP g0c1 [gp=0x60,ATT] [ASCII] [cached] "bar"
See [1] for more information on the usage of this function.
Resources: