Describe the structure of an object, recursively.

showStructure(x, maxlen = 20, describeAttributes = TRUE,
   short = NULL, prefix = "", attri = FALSE, ...)

Arguments

x

any object

maxlen

integer; if x is a list with more than maxlen components, only the names are printed. This may be a vector, in which case the Kth element is used at the Kth level of recursion.

describeAttributes

logical; if FALSE then only the names of attributes are printed; the structure of the attributes is not shown.

short

NULL or logical; this may be used by methods, to indicate whether to print a shorter description. It is currently used by bdFrame and bdVector methods

prefix

for internal use in recursive calls. This is used for indenting in recursive calls.

attri

for internal use in recursive calls. This is TRUE if the curent object being described is a list of attributes.

...

Additional argument that may be passed to methods; not currently used.

Value

This prints a description; it doesn't return anything useful.

Details

This supports recursive objects, using recursive calls. Each level of recursion is indented two additional spaces. List components are shown with $, slots with @, and attributes with &.

Author

Tim Hesterberg

See also

Examples

a <- c(m=1, n=2)
b <- diag(1:3)
cc <- cbind(a=1:5, b=2:6, c=letters[1:5])
d <- data.frame(cc)
attr(d, "dup.row.names") <- TRUE
e <- ts(1:10, frequency = 4, start = c(1959, 2))
f <- list(a,b=b)
setClass("track", representation(x="numeric", y="numeric"))
g <- new("track", x=1:5, y=1:5)

showStructure(a)
#> numeric[ length 2]  class: numeric 
showStructure(b)
#> numeric[3,3]  class: matrix array 
showStructure(cc)
#> character[5,3]  class: matrix array 
#>  attributes: dimnames 
showStructure(d)
#> list[5,3]  S3 class: data.frame 
#>  &row.names       numeric[ length 5]  class: integer 
#>  &dup.row.names   logical[ length 1]  class: logical 
#>  $a   character[ length 5]  class: character 
#>  $b   character[ length 5]  class: character 
#>  $c   character[ length 5]  class: character 
showStructure(e)
#> numeric[ length 10]  S3 class: ts 
#>  &tsp   numeric[ length 3]  class: numeric 
showStructure(f)
#> list[ length 2]  class: list 
#>  $1   numeric[ length 2]  class: numeric 
#>  $b   numeric[3,3]  class: matrix array 
showStructure(g)  # prints with @ rather than $
#> S4[ length 2]  S4 class: track 
#>  @x   numeric[ length 5]  class: integer 
#>  @y   numeric[ length 5]  class: integer 
showStructure(list(a=a, b=b))
#> list[ length 2]  class: list 
#>  $a   numeric[ length 2]  class: numeric 
#>  $b   numeric[3,3]  class: matrix array 
showStructure(list(cc=cc, d, list(a,e)))
#> list[ length 3]  class: list 
#>  $cc   character[5,3]  class: matrix array 
#>    attributes: dimnames 
#>  $2    list[5,3]  S3 class: data.frame 
#>    &row.names         numeric[ length 5]  class: integer 
#>    &dup.row.names     logical[ length 1]  class: logical 
#>    $a     character[ length 5]  class: character 
#>    $b     character[ length 5]  class: character 
#>    $c     character[ length 5]  class: character 
#>  $3    list[ length 2]  class: list 
#>    $1     numeric[ length 2]  class: numeric 
#>    $2     numeric[ length 10]  S3 class: ts 
#>      &tsp       numeric[ length 3]  class: numeric