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

R1C1_to_A1

Convert R1C1 positioning notation to A1 notation


Description

Convert cell reference strings from R1C1 to A1 format. This only makes sense for absolute references, such as "R4C2". Why? Because otherwise, we'd have to know the host cell of the reference. Relative and mixed references, like ("R[3]C[-1]" and "R[1]C5"), will therefore return NA.

Usage

R1C1_to_A1(x, strict = TRUE)

Arguments

x

vector of cell positions in R1C1 notation

strict

logical, affects reading and writing of A1 formatted cell references. When strict = TRUE, references must be declared absolute through the use of dollar signs, e.g., $A$1, for parsing. When making a string, strict = TRUE requests dollar signs for absolute reference. When strict = FALSE, pure relative reference strings will be interpreted as absolute, i.e. A1 and $A$1 are treated the same. When making a string, strict = FALSE will cause dollars signs to be omitted in the reference string.

Value

character vector of absolute cell references in A1 notation

Examples

R1C1_to_A1("R1C1")
R1C1_to_A1("R10C52", strict = FALSE)
R1C1_to_A1(c("R1C1", "R10C52", "RC4", "R[-3]C[9]"))

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.