Learn R Programming

fifer (version 1.1)

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.

See Also

excelCols

Examples

Run this code
fake.names = paste("Variable", 1:1000, sep="")
# find the Variable name corresponding to AC
excelMatch("AC", names=fake.names)
# find the column number instead
excelMatch("AC", n=1000)

Run the code above in your browser using DataLab