anat: Display the Anatomy of a Data Frame

Description Usage Arguments Examples

View source: R/anat.R

Description

This function displays the 'anatomy' of a data frame. In practice, it's used to implement a faster version of str for data frames built entirely of atomic vectors, as str.data.frame is very slow for large data frames. If there are non-atomic vectors in df, we fall back to base::str.

Usage

1
2
3
anat(df, n = 3, cols = 99)

anatomy(df, n = 3, cols = 99)

Arguments

df

An object inheriting class data.frame.

n

The number of elements to print from each vector.

cols

The number of columns to print from the data.frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
local({
  bigDF <- as.data.frame( matrix( factor(1:1E3), nrow=1E3, ncol=1E3 ) )
  sink( tmp <- tempfile() )
  str <- system.time( str(bigDF, list.len=1E3) )
  anat <- system.time( anat(bigDF) )
  sink()
  unlink(tmp)
  print( rbind( str, anat ) )
})

## End(Not run)

Example output

     user.self sys.self elapsed user.child sys.child
str      0.418    0.003   0.422          0         0
anat     0.028    0.000   0.028          0         0

Kmisc documentation built on May 29, 2017, 1:43 p.m.

Related to anat in Kmisc...