get.cols: Extract column index

Description Usage Arguments Value Author(s) See Also Examples

View source: R/make.null.R

Description

Given a vector of strings and another reference vector, get.cols will search the reference vector for matches and return the column indices where each string was located. See examples.

Usage

1
get.cols(string, names)

Arguments

string

the name of a variable (string)

names

the names of the variables for which you wish to extract the column

Value

an integer corresponding to the column index(indices)

Author(s)

Dustin Fife

See Also

make.null, r

Examples

1
2
3
names = LETTERS[1:10]
get.cols(c("A", "B", "D"), LETTERS[1:10])  ### works
#get.cols(c("A", "B", "Z"), LETTERS[1:10])  ### doesn't work

dustinfife/fifer documentation built on Oct. 31, 2020, 3:36 p.m.