Print {lazy.tools}R Documentation

Print arguments with their names and formats

Description

Print arguments with their names and formats

Usage

Print(
  ...,
  fmt = NULL,
  NAchar = ".",
  fuzz = -1,
  fuzzchar = "..",
  sep = ",",
  removeatt = 0,
  printrowname = 0,
  printrownames = 0,
  debug = 0
)

Arguments

...

objects to be printed with name.

fmt

A vector of formatC to be used

NAchar

a character to represent NA.

fuzz

Those elements which satisfy abs(X) < fuzz will be printed.

fuzzchar

Replacement character(s) for those abs(X) < fuzz.

sep

character to be used as the delimiter.

removeatt

= 1 to remove the attributes from each of ... .

printrowname

= 0 not to print rownames when printing vector.

printrownames

Same as printrowname.

debug

= 1 to dump intermediate result.

Details

If ... contains lists or data.frames, they will be printed separetely.


Except for the case when ... consists of a single vector, vectors will be printed as column vectors without row/col names.
To add rownames to vectors, specify printrowname=1.
"/" or "\n" can be used as the line break.

If any of the input matrices does not have row/col names they will be generated using "r" and "c" as the roots.
If the first argument is a number or a quoted string, it will be printed as it is (without name.)

When there are only two objects to be printed, and the first one is a constant and the second one is not a matrix, there will be no line breaks between the first and the second objects unless the first one has "\n".
compare:

    Print("first", pi)
    Print("first\n", pi )
    Print("first", pi, pi )


fmt contains formats to be used separated by commas or blanks:
fmt="FNameWid.Digits" will use the following formatC function
formatC( object, format="FName", width=Wid, digits=Digits )
to format the object.
If there are more objects in ... than length(fmt), the last fmt value will be used to fill.
When fmt is given, the attributes of the object may be printed together.
Use removeatt=1 to remove all the attributes except dimnames and dim.

Value

None.

Examples

bool <- TRUE; num <- 1; cpl <- 1+1i; str <- "Hello."
vec <- 1:10; mat <- matrix(c(1, 2, 3), 3, 2)
lis <- list(a=1:3, b="abc",NA); df <- data.frame(a=1:2,b=2:3,c="cc")
Print(bool, num, cpl, str, lis, vec, df, mat, plot, sin(0))

A=demomat(3,2)
Print("This is what I need.", A)
Print(A/22)
Print(A/22, A/22, fmt="6.2, 8.4")
Print(A/22, fuzz=0.6)

Print(diag(5),1:3)
Print(diag(5), diag(2))
Print(diag(5), "/", diag(5))
char_vec <- "This is a character vector."
Print("string", char_vec, t(1:2))

B <- demomat(3,3,2,supermat=2)
Print(B,fmt="6.3")
Print(B,fmt="6.3", removeatt=1)



[Package lazy.tools version 0.1.4 ]