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.
A1_to_R1C1(x, strict = TRUE)character vector of cell references in A1 format
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.
character vector of absolute cell references in R1C1 format
A1_to_R1C1("$A$1")
#> Error in loadNamespace(x): there is no package called ‘rematch’
A1_to_R1C1("A1") ## raises a warning, returns NA
#> Error in loadNamespace(x): there is no package called ‘rematch’
A1_to_R1C1("A1", strict = FALSE) ## unless strict = FALSE
#> Error in loadNamespace(x): there is no package called ‘rematch’
A1_to_R1C1(c("A1", "B$4")) ## raises a warning, includes an NA, because
#> Error in loadNamespace(x): there is no package called ‘rematch’
A1_to_R1C1(c("A1", "B$4"), strict = FALSE) ## mixed ref always returns NA
#> Error in loadNamespace(x): there is no package called ‘rematch’