Learn R Programming

caOmicsV (version 1.2.0)

sortOmicsDataByColumn: Sort Omics Data by Column Header

Description

Sort omics data by column header (sample names) based on the order of the second argument. The sample names in the first argument must have same items as the second argument except of order. After sorting, the sample names in omics data and the second argument will be in same order.

Usage

sortOmicsDataByColumn(omicsData, sampleNames)

Arguments

omicsData
A data frame that holds genomic data such as gene expression, SNV, RNASeq ... The column headers must be the sample names that are same as the sample names in clinical data.
sampleNames
character vector, sample names in a given order (such as diagnosis). No redundant entries allowed.

Value

omicsData
copy of the first argument with columns in new order.

Examples

Run this code
    data(RNASeqDemoData)
    sampleNames <- colnames(RNASeqDemoData)[-1]
    sampleNames <- sampleNames[length(sampleNames):1]
    expr <- sortOmicsDataByColumn(RNASeqDemoData, sampleNames)

Run the code above in your browser using DataLab