EVOLUTION-MANAGER
Edit File: dim.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: Dimensions 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 dim {base}"><tr><td>dim {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Dimensions of an Object</h2> <h3>Description</h3> <p>Retrieve or set the dimension of an object. </p> <h3>Usage</h3> <pre> dim(x) dim(x) <- value </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>an <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span> object, for example a matrix, array or data frame.</p> </td></tr> <tr valign="top"><td><code>value</code></td> <td> <p>For the default method, either <code>NULL</code> or a numeric vector, which is coerced to integer (by truncation).</p> </td></tr> </table> <h3>Details</h3> <p>The functions <code>dim</code> and <code>dim<-</code> are <a href="InternalMethods.html">internal generic</a> <a href="Primitive.html">primitive</a> functions. </p> <p><code>dim</code> has a method for <code><a href="data.frame.html">data.frame</a></code>s, which returns the lengths of the <code>row.names</code> attribute of <code>x</code> and of <code>x</code> (as the numbers of rows and columns respectively). </p> <h3>Value</h3> <p>For an array (and hence in particular, for a matrix) <code>dim</code> retrieves the <code>dim</code> attribute of the object. It is <code>NULL</code> or a vector of mode <code><a href="integer.html">integer</a></code>. </p> <p>The replacement method changes the <code>"dim"</code> attribute (provided the new value is compatible) and removes any <code>"dimnames"</code> <em>and</em> <code>"names"</code> attributes. </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="nrow.html">ncol</a></code>, <code><a href="nrow.html">nrow</a></code> and <code><a href="dimnames.html">dimnames</a></code>. </p> <h3>Examples</h3> <pre> x <- 1:12 ; dim(x) <- c(3,4) x # simple versions of nrow and ncol could be defined as follows nrow0 <- function(x) dim(x)[1] ncol0 <- function(x) dim(x)[2] </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>