excelMatch: Obtain column number or variable name from Excel named Columns
Description
Obtain column number or variable name from Excel named Columns
Usage
excelMatch(..., n = NULL, names = NULL)
Arguments
...
An Excel-like string consisting of all capital letters (e.g., "AAQ", "BZ", "RQ", "S", etc.)
n
the number of columns of the data of interest
names
the column names of the data of interest
Value
either a variable name or column number
Details
Excel columns are labeled with letters (e.g., A, B, C, ... AA, AB, AC, etc). This function
accepts a string (e.g., "AAC") and returns either a number that indicates where that string falls
in the sequence of excel named columns, or it returns the variable name corresponding to that column number.
fake.names = paste("Variable", 1:1000, sep="")
# find the Variable name corresponding to ACexcelMatch("AC", names=fake.names)
# find the column number insteadexcelMatch("AC", n=1000)