A1_to_R1C1: Convert cell reference strings from A1 to R1C1 format

Description Usage Arguments Value Examples

View source: R/A1-to-from-RC.R

Description

Convert cell reference strings from A1 to R1C1 format. Strictly speaking, this only makes sense for absolute references, such as "$B$4". Why? Because otherwise, we'd have to know the host cell of the reference. Set strict = FALSE to relax and treat pure relative references, like ("B4"), as if they are absolute. Mixed references, like ("B$4"), will always return NA, no matter the value of strict.

Usage

1
A1_to_R1C1(x, strict = TRUE)

Arguments

x

character vector of cell references in A1 format

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 R1C1 format

Examples

1
2
3
4
5
A1_to_R1C1("$A$1")
A1_to_R1C1("A1")                 ## raises a warning, returns NA
A1_to_R1C1("A1", strict = FALSE) ## unless strict = FALSE
A1_to_R1C1(c("A1", "B$4")) ## raises a warning, includes an NA, because
A1_to_R1C1(c("A1", "B$4"), strict = FALSE) ## mixed ref always returns NA

jennybc/cellranger documentation built on May 19, 2019, 4:04 a.m.