Description Usage Arguments Details Value Note References See Also Examples
Outputs the objects, concatenating the representations. cat
performs much less conversion than print
.
1 2 |
... |
R objects (see ‘Details’ for the types of objects allowed). |
file |
A connection, or a character string naming the file
to print to. If |
sep |
a character vector of strings to append after each element. |
fill |
a logical or (positive) numeric controlling how the output is
broken into successive lines. If |
labels |
character vector of labels for the lines printed.
Ignored if |
append |
logical. Only used if the argument |
cat
is useful for producing output in user-defined functions.
It converts its arguments to character vectors, concatenates
them to a single character vector, appends the given sep =
string(s) to each element and then outputs them.
No linefeeds are output unless explicitly requested by "\n"
or if generated by filling (if argument fill
is TRUE
or
numeric).
If file
is a connection and open for writing it is written from
its current position. If it is not open, it is opened for the
duration of the call in "wt"
mode and then closed again.
Currently only atomic vectors and names are handled,
together with NULL
and other zero-length objects (which produce
no output). Character strings are output ‘as is’ (unlike
print.default
which escapes non-printable characters and
backslash — use encodeString
if you want to output
encoded strings using cat
). Other types of R object should be
converted (e.g., by as.character
or format
)
before being passed to cat
. That includes factors, which are
output as integer vectors.
cat
converts numeric/complex elements in the same way as
print
(and not in the same way as as.character
which is used by the S equivalent), so options
"digits"
and "scipen"
are relevant. However, it uses
the minimum field width necessary for each element, rather than the
same field width for all elements.
None (invisible NULL
).
If any element of sep
contains a newline character, it is
treated as a vector of terminators rather than separators, an element
being output after every vector element and a newline after the
last. Entries are recycled as needed.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
print
, format
, and paste
which concatenates into a string.
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.