Learn R Programming

fifer (version 1.1)

r: Extract variable column indices

Description

Given a starting string and an ending string, r will extract all columns between the first and the last string and return either a vector of strings or a vector of integers. See examples.

Usage

r(stringA, stringB, data.names, names = F)

Arguments

stringA
the name of the first variable you wish to extract the column for in sequence
stringB
the name of the last variable you wish to extract the column for in sequence
data.names
the names of the dataset
names
Should the names of the variables be returned? Or the column indices? Defaults to FALSE (meaning the column indices will be returned).

Value

a vector of numbers corresponding to the column names

See Also

make.null, get.cols

Examples

Run this code
var.names = LETTERS[1:20]
r("C", "F", var.names)

Run the code above in your browser using DataLab