View source: R/identify_column.R
identify_column | R Documentation |
This function is a subroutine of translate_header
and several other functions. It is used to translate non-standard
column names into standard ones.
identify_column(std_name, alt_names, header)
std_name |
character string; the standard name for the data-column. |
alt_names |
translation table; with in the left column
the standard name(s) and in the right column possible
alternatives. See |
header |
the column names of the dataset. The names should be entirely in uppercase. |
The purpose of identify_column
is essentially to look
up in the translation table (alt_names
) which of the
names in header
can be translated into std_name
.
An integer vector of the entry(s) in header
(i.e. the
column-numbers) that can be translated into std_name
.
translate_header
sample_data <- data.frame(SNP = paste("rs", 1:10, sep = ""), chrom = 2, effect = 1:10/10, misc = NA) sample_header <- toupper(names(sample_data)) alt_headers <- data.frame( standard = c("MARKER", "MARKER", "CHR", "CHR"), alternative = c("MARKER", "SNP", "CHR", "CHROM"), stringsAsFactors = FALSE) identify_column(std_name = "EFFECT", alt_names = alt_headers, header = sample_header) identify_column(std_name = "MARKER", alt_names = alt_headers, header = sample_header) identify_column(std_name = "CHR", alt_names = alt_headers, header = sample_header) identify_column(std_name = "MISC", alt_names = alt_headers, header = sample_header)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.