General Printing

DESCRIPTION:
Coerces arguments to mode "character" and then prints to standard output, or to a specified file.

USAGE:
cat(..., file=<<see below>>, sep=" ", fill=F, labels=NULL, append=F)

REQUIRED ARGUMENTS:
...:
any S-PLUS objects. The objects will be coerced to character data and printed, using the other arguments to control the output. All the elements of the first object will be printed, then all the elements of the second, and so on.

OPTIONAL ARGUMENTS:
file=:
character string naming the file on which to print. If file is "" (the default), cat prints to the standard output.
sep=:
vector of character strings to insert between successive data items of each object. This argument is used cyclically and if it contains a newline, the output will contain a final newline.
fill=:
logical or numeric; should the output be automatically broken into successive lines, with newline characters added after each line? If numeric, the value of fill controls the width of the printing. If TRUE, the option width controls the width of the printing.
labels=:
vector of character strings to be used as labels at the start of each line. The labels are used cyclically if there are too few. This is only relevant if fill is TRUE or non-zero.
append=:
logical flag: if TRUE, output will be appended to file; otherwise, output will overwrite the contents of file.

SIDE EFFECTS:
either the objects are printed, or file is created or appended.

DETAILS:
When fill is FALSE, there are no newline characters printed except those created explicitly with a backslash-n. Tabs are created with backslash-t and backslashes are printed using a double backslash.

When fill is a positive number, a newline is placed before the first string that makes the present line exceed fill characters. If present, labels is cycled through. Each label is paired with a character string; so if there were only two labels and an even number of strings on each line, only the first label would be printed.

A special case occurs when only one string is given (i.e., one argument of length one) and fill = TRUE. In this case cat will break the string at any internal white space to avoid overrunning the width of the line. In other words, if you want to have your output broken at arbitrary white space, not just between items, first make the output into a single string (by the function paste, for example) and give that string to cat with fill = TRUE.

Also, cat will print each numeric value to as many digits as needed to represent it. You might want to use format to control the formatting of numeric values.


NOTE:
cat is not designed to produce a full description of arbitrary S-PLUS objects; for this, use dput, dump or data.dump. To get output as S-PLUS ordinarily prints it, use the print function (and use sink to capture this output in a file).

SEE ALSO:
print , options , format .

EXAMPLES:
cat("current x:", x, fill=T)
cat("Today's date is:",date(),"\n")
cat(1,2,3,4,5,6, fill=4, labels=letters[1:6])
cat(rnorm(40), fill=T, labels=c("odd string first","even string first"))