pprint: Pretty Printing

Description Usage Arguments Details Examples

Description

Prettier printing for matrices and data frames.

Usage

1
2
3
4
5
6
7
8
9
pprint(x, ...)

## S3 method for class 'matrix'
pprint(x, rowdots = NULL, coldots = NULL, digits = NULL,
  ...)

## S3 method for class 'data.frame'
pprint(x, rowdots = NULL, coldots = NULL,
  digits = NULL, ...)

Arguments

x

An object of class "matrix" or "data.frame".

...

Additional optional arguments. None are used at present.

rowdots

Integer specifying the row to replace with ... notation. Default is 4.

coldots

Integer specifying the column to replace with ... notation. Default is 4.

digits

The minimum number of significant digits to be printed in values.

Details

For object of class "matrix" or "data.frame" (which are coerced to a matrix via the data.matrix function), pprint will replace all the rows starting from rowdots up to and including the second-to-last row with a single row filled with ...s. The same is applied to the columns as well. Hence a large matrix (or data frame) will be printed in a much more compact form.

Examples

1
2
pprint(randn(100, 100))
pprint(resize(1:100, 10, 10))

Example output

Attaching package: 'ramify'

The following object is masked from 'package:graphics':

    clip

100 x 100 matrix of doubles: 

             [,1]       [,2]       [,3] ...     [,100]
[1,]   -1.1667548  1.0374499  0.4491435 ... -0.1331986
[2,]   -0.0789353  0.1745762 -0.2807764 ...  0.1309119
[3,]    1.3526968  0.3271707  0.5558635 ... -1.4137990
...           ...        ...        ... ...        ...
[100,]  2.3584320 -0.4351231 -1.2907587 ... -0.5798657
10 x 10 matrix of integers: 

      [,1] [,2] [,3] ... [,10]
[1,]     1   11   21 ...    91
[2,]     2   12   22 ...    92
[3,]     3   13   23 ...    93
...    ...  ...  ... ...   ...
[10,]   10   20   30 ...   100

ramify documentation built on May 2, 2019, 5:58 a.m.