R: Create a cell_limits object

cell_limits {cellranger} | R Documentation

## Create a cell_limits object

### Description

A `cell_limits` object is a list with three components:

### Usage

    cell_limits(ul = c(NA_integer_, NA_integer_), lr = c(NA_integer_,
      NA_integer_), sheet = NA_character_)

    ## S3 method for class 'cell_limits'
    dim(x)

    as.cell_limits(x, ...)

    ## S3 method for class 'cell_limits'
    as.cell_limits(x, ...)

    ## S3 method for class 'NULL'
    as.cell_limits(x, ...)

    ## S3 method for class 'character'
    as.cell_limits(x, fo = NULL, ...)

### Arguments

`ul` | vector identifying upper left cell of target rectangle
`lr` | vector identifying lower right cell of target rectangle
`sheet` | string containing worksheet name, optional
`x` | input to convert into a `cell_limits` object
`...` | further arguments passed to or from other methods
`fo` | either `"R1C1"` (the default) or `"A1"` specifying the cell reference format; in many contexts, it can be inferred and is optional

### Details

- `ul` vector specifying upper left cell of target rectangle, of the form `c(ROW_MIN, COL_MIN)`

- `lr` vector specifying lower right cell of target rectangle, of the form `c(ROW_MAX, COL_MAX)`

- `sheet` string specifying worksheet name, which may be `NA`, meaning it's unspecified

A value of `NA` in `ul` or `lr` means the corresponding limit is left unspecified. Therefore a verbose way to specify no limits at all would be `cell_limits(c(NA, NA), c(NA, NA))`. If the maximum row or column is specified but the associated minimum is not, then the minimum is set to 1.

When specified via character, cell references can be given in A1 or R1C1 notation and must be interpretable as absolute references. For A1, this means either both row and column are annotated with a dollar sign `$` or neither is. So, no mixed references, like `B$4`. For R1C1, this means no square brackets, like `R[-3]C[3]`.

### Value

a `cell_limits` object

### Examples

    cell_limits(c(1, 3), c(1, 5))
    cell_limits(c(NA, 7), c(3, NA))
    cell_limits(c(NA, 7))
    cell_limits(lr = c(3, 7))

    cell_limits(c(1, 3), c(1, 5), "Sheet1")
    cell_limits(c(1, 3), c(1, 5), "Spaces are evil")

    dim(as.cell_limits("A1:F10"))

    as.cell_limits("A1")
    as.cell_limits("$Q$24")
    as.cell_limits("A1:D8")
    as.cell_limits("R5C11")
    as.cell_limits("R2C3:R6C9")
    as.cell_limits("Sheet1!R2C3:R6C9")
    as.cell_limits("'Spaces are evil'!R2C3:R6C9")

    ## Not run:
    ## explicitly mixed A1 references won't work
    as.cell_limits("A$2")
    ## mixed or relative R1C1 references won't work
    as.cell_limits("RC[4]")

    ## End(Not run)

[Package cellranger version 1.1.0 Index]