Skip to contents

Join a new data frame of information to pheno data of a MetaboSet object.

Usage

join_pData(object, dframe)

Arguments

object

a MetaboSet object

dframe

a data frame with the new information

Value

A MetaboSet object with the new information added to pData(object).

Examples

data(example_set)
ex_set <- as(example_set, "MetaboSet")
#> INFO [2025-06-23 22:36:43] 
#> Checking feature information
#> INFO [2025-06-23 22:36:43] Checking that feature IDs are unique and not storedas numbers
#> INFO [2025-06-23 22:36:43] Checking that feature data includes a 'Split' column
#> INFO [2025-06-23 22:36:43] Checking that feature data includes a 'Flag' column
#> INFO [2025-06-23 22:36:43] Checking that feature abundances only contain numeric values
#> INFO [2025-06-23 22:36:43] Setting row and column names of exprs based on feature and pheno data
new_info <- data.frame(
  Sample_ID = sampleNames(ex_set),
  BMI = stats::runif(ncol(ex_set), 22, 26)
)
with_new_info <- join_pData(ex_set, new_info)
#> Joining with `by = join_by(Sample_ID)`
colnames(pData(with_new_info))
#>  [1] "Sample_ID"          "Injection_order"    "Subject_ID"        
#>  [4] "Group"              "QC"                 "Time"              
#>  [7] "Batch"              "HILIC_neg_Datafile" "HILIC_pos_Datafile"
#> [10] "RP_neg_Datafile"    "RP_pos_Datafile"    "BMI"