EVOLUTION-MANAGER
Edit File: head.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: Return the First or Last Part of an Object</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 head {utils}"><tr><td>head {utils}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Return the First or Last Part of an Object </h2> <h3>Description</h3> <p>Returns the first or last parts of a vector, matrix, table, data frame or function. Since <code>head()</code> and <code>tail()</code> are generic functions, they may also have been extended to other classes. </p> <h3>Usage</h3> <pre> head(x, ...) ## Default S3 method: head(x, n = 6L, ...) ## S3 method for class 'data.frame' head(x, n = 6L, ...) ## S3 method for class 'matrix' head(x, n = 6L, ...) ## S3 method for class 'ftable' head(x, n = 6L, ...) ## S3 method for class 'table' head(x, n = 6L, ...) ## S3 method for class 'function' head(x, n = 6L, ...) tail(x, ...) ## Default S3 method: tail(x, n = 6L, ...) ## S3 method for class 'data.frame' tail(x, n = 6L, ...) ## S3 method for class 'matrix' tail(x, n = 6L, addrownums = TRUE, ...) ## S3 method for class 'ftable' tail(x, n = 6L, addrownums = FALSE, ...) ## S3 method for class 'table' tail(x, n = 6L, addrownums = TRUE, ...) ## S3 method for class 'function' tail(x, n = 6L, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>an object</p> </td></tr> <tr valign="top"><td><code>n</code></td> <td> <p>a single integer. If positive or zero, size for the resulting object: number of elements for a vector (including lists), rows for a matrix or data frame or lines for a function. If negative, all but the <code>n</code> last/first number of elements of <code>x</code>.</p> </td></tr> <tr valign="top"><td><code>addrownums</code></td> <td> <p>if there are no row names, create them from the row numbers.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>arguments to be passed to or from other methods.</p> </td></tr> </table> <h3>Details</h3> <p>For matrices, 2-dim tables and data frames, <code>head()</code> (<code>tail()</code>) returns the first (last) <code>n</code> rows when <code>n >= 0</code> or all but the last (first) <code>n</code> rows when <code>n < 0</code>. <code>head.matrix()</code> and <code>tail.matrix()</code> are exported. For functions, the lines of the deparsed function are returned as character strings. </p> <p>If a matrix has no row names, then <code>tail()</code> will add row names of the form <code>"[n,]"</code> to the result, so that it looks similar to the last lines of <code>x</code> when printed. Setting <code>addrownums = FALSE</code> suppresses this behaviour. </p> <h3>Value</h3> <p>An object (usually) like <code>x</code> but generally smaller. For <code><a href="../../stats/html/ftable.html">ftable</a></code> objects <code>x</code>, a transformed <code>format(x)</code>. </p> <h3>Author(s)</h3> <p>Patrick Burns, improved and corrected by R-Core. Negative argument added by Vincent Goulet. </p> <h3>Examples</h3> <pre> head(letters) head(letters, n = -6L) head(freeny.x, n = 10L) head(freeny.y) tail(letters) tail(letters, n = -6L) tail(freeny.x) tail(freeny.y) tail(library) head(stats::ftable(Titanic)) </pre> <hr /><div style="text-align: center;">[Package <em>utils</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>