Join us for
RADAR: AI Edition

cape (version 2.0.2)

get.col.num: Use column titles to retrieve column numbers

Description

This function is used internally to tranlate column names to column numbers.

Usage

get.col.num(data.mat, col.which = NULL, warn = TRUE)

Arguments

data.mat
A matrix with column names
col.which
The names of the columns for which numbers are wanted
warn
A logical indicating whether the use should be warned if any of the entries in col.which are not found.

Value

Returns a numeric value indicating the column number of the value of interest.

Examples

Run this code

mat <- matrix(rnorm(50), ncol = 5)
colnames(mat) <- letters[1:5]
print(mat)
col.num <- get.col.num(mat, c("c", "e"))
print(col.num)

col.num <- get.col.num(mat, c("b", "g"))
print(col.num)

Run the code above in your browser using DataLab