Skip to contents

This function prints abbreviated matrices and vectors.

Usage

pprint(x, rowdots = 4, coldots = 4, digits = 4, name = NULL, desc = TRUE)

Arguments

x

A (numeric or character) matrix or a vector.

rowdots

The row number which is replaced by dots.

coldots

The column number which is replaced by dots.

digits

If x is numeric, sets the number of decimal places.

name

Either NULL or a label for x. Only printed if desc = TRUE.

desc

Set to TRUE to print the name and the dimension of x.

Value

Invisibly returns x.

References

This function is a modified version of the pprint() function from the ramify R package.

Examples

RprobitB:::pprint(x = 1, name = "single integer")
#> single integer : 1
RprobitB:::pprint(x = LETTERS[1:26], name = "letters")
#> letters : character vector of length 26 
#> 
#> A B C ... Z
RprobitB:::pprint(x = matrix(rnorm(100), ncol = 1),
                  name = "single column matrix")
#> single column matrix : 100 x 1 matrix of doubles 
#> 
#>           [,1]
#> [1,]    1.1144
#> [2,]   -0.0042
#> [3,]   -1.0775
#> ...        ...
#> [100,] -0.4254
RprobitB:::pprint(x = matrix(1:100, nrow = 1), name = "single row matrix")
#> single row matrix : 1 x 100 matrix of integers 
#> 
#>      [,1] [,2] [,3] ... [,100]
#> [1,]    1    2    3 ...    100
RprobitB:::pprint(x = matrix(LETTERS[1:24], ncol = 6), name = "big matrix")
#> big matrix : 4 x 6 matrix of characters 
#> 
#>      [,1] [,2] [,3] ... [,6]
#> [1,]    A    E    I ...    U
#> [2,]    B    F    J ...    V
#> [3,]    C    G    K ...    W
#> [4,]    D    H    L ...    X