getPosColumn: getPosColumn

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Identify the column in a data.frame or equivalent with the position information

Usage

1
getPosColumn(df, col = NULL, avoid.pattern = NULL, needed = TRUE, verbose = TRUE)

Arguments

df

(data.frame or equivalent) The object were columns are searched. It must be either a data.frame or an object where names(df) works.

col

(number or character) The column to identify. If NULL an heuristic will be used to automatically identify the column. It can also a number or a character to define the exact column to return.(defaults to NULL)

avoid.pattern

(character) An optional pattern to avoid on the column name. The pattern may be any valid regular expression. (defaults to "")

needed

(logical) Whether the column is needed or not. If TRUE, an error will be raised if the column is not found. (defaults to TRUE)

verbose

Whether to show information messages. (defaults to TRUE)

Details

Identify the column of a data.frame or equivalent that contains the position information and return its position

Value

The number of the column matching the specification or NULL if no column was found.

Examples

1
2
3
4
5
df <- data.frame("id"= "rs1234","chromosome"="chr1", "Start"=0, "end.position"=100,
"copy.number.level"=3, "LOH"=0, "median.value.per.segment"=1.2,
"BAF"=0.2, "Log Ratio"=1.5, "strange.name"="strange.value")
col.num <- getPosColumn(df = df)
col.num <- getPosColumn(df = df, col = "strange.name")

CopyNumberPlots documentation built on Nov. 8, 2020, 6:51 p.m.