EVOLUTION-MANAGER
Edit File: cat.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Concatenate and Print</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for cat {base}"><tr><td>cat {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Concatenate and Print</h2> <h3>Description</h3> <p>Outputs the objects, concatenating the representations. <code>cat</code> performs much less conversion than <code><a href="print.html">print</a></code>. </p> <h3>Usage</h3> <pre> cat(... , file = "", sep = " ", fill = FALSE, labels = NULL, append = FALSE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p><span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> objects (see ‘Details’ for the types of objects allowed).</p> </td></tr> <tr valign="top"><td><code>file</code></td> <td> <p>A <a href="connections.html">connection</a>, or a character string naming the file to print to. If <code>""</code> (the default), <code>cat</code> prints to the standard output connection, the console unless redirected by <code><a href="sink.html">sink</a></code>. If it is <code>"|cmd"</code>, the output is piped to the command given by ‘<span class="file">cmd</span>’, by opening a pipe connection. </p> </td></tr> <tr valign="top"><td><code>sep</code></td> <td> <p>a character vector of strings to append after each element.</p> </td></tr> <tr valign="top"><td><code>fill</code></td> <td> <p>a logical or (positive) numeric controlling how the output is broken into successive lines. If <code>FALSE</code> (default), only newlines created explicitly by <span class="samp">"\n"</span> are printed. Otherwise, the output is broken into lines with print width equal to the option <code>width</code> if <code>fill</code> is <code>TRUE</code>, or the value of <code>fill</code> if this is numeric. Non-positive <code>fill</code> values are ignored, with a warning.</p> </td></tr> <tr valign="top"><td><code>labels</code></td> <td> <p>character vector of labels for the lines printed. Ignored if <code>fill</code> is <code>FALSE</code>.</p> </td></tr> <tr valign="top"><td><code>append</code></td> <td> <p>logical. Only used if the argument <code>file</code> is the name of file (and not a connection or <code>"|cmd"</code>). If <code>TRUE</code> output will be appended to <code>file</code>; otherwise, it will overwrite the contents of <code>file</code>.</p> </td></tr> </table> <h3>Details</h3> <p><code>cat</code> 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 <code>sep = </code> string(s) to each element and then outputs them. </p> <p>No linefeeds are output unless explicitly requested by <span class="samp">"\n"</span> or if generated by filling (if argument <code>fill</code> is <code>TRUE</code> or numeric). </p> <p>If <code>file</code> 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 <code>"wt"</code> mode and then closed again. </p> <p>Currently only <a href="vector.html">atomic</a> vectors and <a href="name.html">name</a>s are handled, together with <code>NULL</code> and other zero-length objects (which produce no output). Character strings are output ‘as is’ (unlike <code><a href="print.default.html">print.default</a></code> which escapes non-printable characters and backslash — use <code><a href="encodeString.html">encodeString</a></code> if you want to output encoded strings using <code>cat</code>). Other types of <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> object should be converted (e.g., by <code><a href="character.html">as.character</a></code> or <code><a href="format.html">format</a></code>) before being passed to <code>cat</code>. That includes factors, which are output as integer vectors. </p> <p><code>cat</code> converts numeric/complex elements in the same way as <code>print</code> (and not in the same way as <code><a href="character.html">as.character</a></code> which is used by the S equivalent), so <code><a href="options.html">options</a></code> <code>"digits"</code> and <code>"scipen"</code> are relevant. However, it uses the minimum field width necessary for each element, rather than the same field width for all elements. </p> <h3>Value</h3> <p>None (invisible <code>NULL</code>). </p> <h3>Note</h3> <p>If any element of <code>sep</code> contains a newline character, it is treated as a vector of terminators rather than separators, an element being output after every vector element <em>and</em> a newline after the last. Entries are recycled as needed. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="print.html">print</a></code>, <code><a href="format.html">format</a></code>, and <code><a href="paste.html">paste</a></code> which concatenates into a string. </p> <h3>Examples</h3> <pre> iter <- stats::rpois(1, lambda = 10) ## print an informative message cat("iteration = ", iter <- iter + 1, "\n") ## 'fill' and label lines: cat(paste(letters, 100* 1:26), fill = TRUE, labels = paste0("{", 1:10, "}:")) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>