Learn R Programming

hiAnnotator (version 1.6.2)

getRelevantCol: Find the column index of interest given the potential choices.

Description

The function finds relevant column(s) of interest from a vector of column names derived from a dataframe. If no usable column is found, the function spits out a relevant error or returns the index of the usable column(s). This is an assistant function called by functions listed in the see also section.

Usage

getRelevantCol(col.names, col.options, col.type = NULL, multiple.ok = FALSE)

Arguments

col.names
column names from a dataframe
col.options
potential column names or partial names that may exist in col.names
col.type
type of column information the function is searching for, used in construction of error messages. Default is NULL.
multiple.ok
if multiple matches are found then return indices, else spit an error out. Default is TRUE.

Value

  • the index of usable column(s) or an error if no applicable column is found.

See Also

makeGRanges, getNearestFeature, getSitesInFeature.

Examples

Run this code
data(sites)
names(sites)
getRelevantCol(names(sites),c("chr","chromosome","tname","seqnames",
"chrom","contig"),"seqnames")
getRelevantCol(names(sites),c("ort","orientation","strand"),"strand")

Run the code above in your browser using DataLab