int2col: Convert integers to spreadsheet column notation

View source: R/converters.R

int2colR Documentation

Convert integers to spreadsheet column notation

Description

int2col() performs the inverse operation of col2int(), transforming numeric column indices into their corresponding spreadsheet-style character labels (e.g., 1 to "A", 28 to "AB"). This is essential for converting calculated indices back into a format compatible with spreadsheet cell referencing.

Usage

int2col(x)

Arguments

x

A numeric vector representing the column indices to be converted.

Details

The function accepts a numeric vector and maps each integer to its positional representation in a base-26 derived system. This mapping follows standard spreadsheet conventions where the sequence progresses from "A" through "Z", followed by "AA", "AB", and so forth.

Validation is performed to ensure the input is numeric and finite. In accordance with the Office Open XML specification used by most spreadsheet software, the maximum supported column index is 16,384, which corresponds to the column label "XFD". Inputs exceeding this range may result in coordinates that are incompatible with standard spreadsheet applications.

Value

A character vector of spreadsheet column labels. Returns NULL if the input x is NULL.

Notes

  • Non-integer numeric values will typically be coerced or truncated; however, infinite values will trigger an error to prevent invalid coordinate generation.

See Also

col2int()

Examples

# Convert a single index
int2col(27)

# Convert a sequence of indices
int2col(1:10)

# Handle large column indices
int2col(c(702, 703, 16384))


openxlsx2 documentation built on March 7, 2026, 5:06 p.m.