Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ra_ref

ra_ref class


Description

The ra_ref class is used to represent a single relative, absolute, or mixed cell reference, presumably found in a formula. When row_abs is TRUE, it means that row_ref identifies a specific row in an absolute sense. When row_abs is FALSE, it means that row_ref holds a positive, zero, or negative offset relative to the address of the cell containing the formula that contains the associated cell reference. Ditto for col_abs and col_ref.

Usage

ra_ref(row_ref = 1L, row_abs = TRUE, col_ref = 1L, col_abs = TRUE,
  sheet = NA_character_, file = NA_character_)

Arguments

row_ref

integer, row or row offset

row_abs

logical indicating whether row_ref is absolute or relative

col_ref

integer, column or column offset

col_abs

logical indicating whether col_ref is absolute or relative

sheet

the name of a sheet (a.k.a. worksheet or tab)

file

the name of a file (a.k.a. workbook)

Details

A ra_ref object can also store the name of a sheet and a file, though these will often be NA. A cell reference in a formula can potentially be qualified like this: [my_workbook.xlxs]Sheet1!R2C3. In Testoft (2014), he creates an entirely separate class for this, a cell_ref, which consists of a sheet- and file-ignorant ra_ref object and a sheet reference (he doesn't allow formulas to refer to other files). I hope I don't regret choosing a different path.

Value

a ra_ref object

Reference

Spreadsheet Implementation Technology: Basics and Extensions Peter Sestoft MIT Press 2014

Examples

ra_ref()
ra_ref(row_ref = 3, col_ref = 2)
ra_ref(row_ref = 10, row_abs = FALSE, col_ref = 3, col_abs = TRUE)
ra_ref(sheet = "a sheet")

cellranger

Translate Spreadsheet Cell Ranges to Rows and Columns

v1.1.0
MIT + file LICENSE
Authors
Jennifer Bryan [cre, aut], Hadley Wickham [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.