JoinPhenoAssay: Merge Phenotype and Assay Data by First Column (Sample ID)

View source: R/createOmics_JoinPhenoAssay.R

JoinPhenoAssayR Documentation

Merge Phenotype and Assay Data by First Column (Sample ID)

Description

Match the records from the phenotype data to the values in the assay data by sample ID. Return rows from each data frame with matches in both data frames. The sample ID must be the first column in both data frames.

Usage

JoinPhenoAssay(pheno_df, assay_df)

Arguments

pheno_df

Phenotype data frame with the sample IDs in the first column

assay_df

Assay data frame with the sample IDs in the first column

Details

Don't use this function. This is simply a wrapper around the merge function with extra checks for the class of the ID column. If you want to merge your two data frames by sample ID, you should use the inner_join function from the dplyr package instead. It's easier. See https://dplyr.tidyverse.org/reference/join.html.

Value

A list of three elements:

  • assay : A data frame with the rows from assay_df which are contained in pheno_df, ordered by their position in pheno_df.

  • response : A data frame with the rows from pheno_df which are contained in assay_df.

  • sampleID : A vector of the sample IDs shared by both data frames, ordered by their position in pheno_df.

Examples

  # DO NOT CALL THIS FUNCTIONS DIRECTLY. USE CreateOmics() INSTEAD.

## Not run: 
 data("colonSurv_df")
 JoinPhenoAssay(
   pheno_df = colonSurv_df[, 1:3],
   assay_df = colonSurv_df[, -(2:3)]
 )

## End(Not run)


gabrielodom/pathwayPCA documentation built on July 10, 2023, 3:32 a.m.