Abstract: Display Compact Abstract of a Data Frame

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Compactly display the content and structure of a data.frame, including variable labels. str is optimised for lists and its output is relatively technical, when it comes to e.g. attributes. summary on the other side already calculates some basic statistics.

Usage

1
Abstract(x, sep = ", ", zero.form = ".", maxlevels = 5, trunc = TRUE, list.len = 999)

Arguments

x

a data.frame to be described

sep

the separator for concatenating the levels of a factor

zero.form

a symbol to be used, when a variable has zero NAs.

maxlevels

integer, defining how many factor levels are to be displayed. Default is 12. Set this to Inf, if all levels are needed.

trunc

logical, defining if level names excceeding the column with should be truncated. Default ist TRUE.

list.len

numeric; maximum number of list elements to display.

Details

The levels of a factor and describing variable labels (as created by Label) will be wrapped within the columns.

The first 4 columns are printed with the needed fix width, the last 2 (Levels and Labels) are wrapped within the column. The width is calculated depending on the width of the screen as given by getOption("width").

ToWord has an interface for the class abstract.

Value

an object of class abstract, essentially a character matrix with 5 or 6 columns containing a sequential nr (Nr), the name of the column (ColName), the class (Class), the number of NAs (NAs), the levels if the variable is a factor (Levels) and - if there are any - descriptive labels for the column (Labels). .

Author(s)

Andri Signorell <andri@signorell.net>

See Also

str, summary, ColumnWrap

Examples

1
2
3
4
5
6
7
8
9
d.mydata <- d.pizza
# let's use some labels
Label(d.mydata) <- "Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
sed diam voluptua. At vero eos et accusam."

Label(d.mydata$temperature) <- "Amet, consetetur sadipscing elitr, sed diam nonumy "

Abstract(d.mydata)

Example output

------------------------------------------------------------------------------ 
d.mydata :
  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
  nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
  erat, sed diam voluptua. At vero eos et accusam.

data.frame:	1209 obs. of  16 variables

  Nr  ColName         Class            NAs          Levels          Label     
  1   index           integer            .                          -         
  2   date            Date              32 (2.6%)                   -         
  3   week            numeric           32 (2.6%)                   -         
  4   weekday         numeric           32 (2.6%)                   -         
  5   area            factor            10 (0.8%)   (3):            -         
                                                    1-Brent,                  
                                                    2-Camden,                 
                                                    3-Westminst...            
  6   count           integer           12 (1.0%)                   -         
  7   rabate          logical           12 (1.0%)                   -         
  8   price           numeric           12 (1.0%)                   -         
  9   operator        factor             8 (0.7%)   (3):            -         
                                                    1-Allanah,                
                                                    2-Maria,                  
                                                    3-Rhonda                  
  10  driver          factor             5 (0.4%)   (7):            -         
                                                    1-Butcher,                
                                                    2-Carpenter...            
                                                    3-Carter,                 
                                                    4-Farmer,                 
                                                    5-Hunter,                 
                                                    ...                       
  11  delivery_min    numeric            .                          -         
  12  temperature     numeric           39 (3.2%)                   Amet,     
                                                                    consetetur
                                                                    sadipscing
                                                                    elitr, sed
                                                                    diam      
                                                                    nonumy    
  13  wine_ordered    integer           12 (1.0%)                   -         
  14  wine_delivered  integer           12 (1.0%)                   -         
  15  wrongpizza      logical            4 (0.3%)                   -         
  16  quality         ordered, factor  201 (16.6%)  (3):            -         
                                                    1-low,                    
                                                    2-medium,                 
                                                    3-high                    

DescTools documentation built on June 17, 2021, 5:12 p.m.