EVOLUTION-MANAGER
Edit File: cell-specification.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: Specify cells for reading</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 cell-specification {readxl}"><tr><td>cell-specification {readxl}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Specify cells for reading</h2> <h3>Description</h3> <p>The <code>range</code> argument of <code><a href="read_excel.html">read_excel()</a></code> provides many ways to limit the read to a specific rectangle of cells. The simplest usage is to provide an Excel-like cell range, such as <code>range = "D12:F15"</code> or <code>range = "R1C12:R6C15"</code>. The cell rectangle can be specified in various other ways, using helper functions. In all cases, cell range processing is handled by the <a href="../../cellranger/html/cellranger.html">cellranger</a> package, where you can find full documentation for the functions used in the examples below. </p> <h3>See Also</h3> <p>The <a href="../../cellranger/html/cellranger.html">cellranger</a> package has full documentation on cell specification and offers additional functions for manipulating "A1:D10" style spreadsheet ranges. Here are the most relevant: </p> <ul> <li> <p><code><a href="../../cellranger/html/cell_limits.html">cellranger::cell_limits()</a></code> </p> </li> <li> <p><code><a href="../../cellranger/html/cell_rows.html">cellranger::cell_rows()</a></code> </p> </li> <li> <p><code><a href="../../cellranger/html/cell_cols.html">cellranger::cell_cols()</a></code> </p> </li> <li> <p><code><a href="../../cellranger/html/anchored.html">cellranger::anchored()</a></code> </p> </li></ul> <h3>Examples</h3> <pre> path <- readxl_example("geometry.xls") ## Rows 1 and 2 are empty (as are rows 7 and higher) ## Column 1 aka "A" is empty (as are columns 5 of "E" and higher) # By default, the populated data cells are "shrink-wrapped" into a # minimal data frame read_excel(path) # Specific rectangle that is subset of populated cells, possibly improper read_excel(path, range = "B3:D6") read_excel(path, range = "C3:D5") # Specific rectangle that forces inclusion of unpopulated cells read_excel(path, range = "A3:D5") read_excel(path, range = "A4:E5") read_excel(path, range = "C5:E7") # Anchor a rectangle of specified size at a particular cell read_excel(path, range = anchored("C4", dim = c(3, 2)), col_names = FALSE) # Specify only the rows or only the columns read_excel(path, range = cell_rows(3:6)) read_excel(path, range = cell_cols("C:D")) read_excel(path, range = cell_cols(2)) # Specify exactly one row or column bound read_excel(path, range = cell_rows(c(5, NA))) read_excel(path, range = cell_rows(c(NA, 4))) read_excel(path, range = cell_cols(c("C", NA))) read_excel(path, range = cell_cols(c(NA, 2))) # General open rectangles # upper left = C4, everything else unspecified read_excel(path, range = cell_limits(c(4, 3), c(NA, NA))) # upper right = D4, everything else unspecified read_excel(path, range = cell_limits(c(4, NA), c(NA, 4))) </pre> <hr /><div style="text-align: center;">[Package <em>readxl</em> version 1.3.1 <a href="00Index.html">Index</a>]</div> </body></html>