Skip to contents

Given the final output/statistical tables from different chromatographics/polarities analyses of the same study (e.g.: HILIC POS, RPLC NEG), it combines together the results.

Usage

merge_results(
  results_list,
  strings_in_colnames_to_remove = "",
  by_column = NULL,
  if_duplicated_consider_columns = NULL,
  decreasing = FALSE,
  name_new_column = "chromatographic_run"
)

Arguments

results_list

a list, each element should be a data frame with the results (e.g. from the statistical analyses) we would combine together. Ideally, each row should be an annotated compound, each column can contain any information about it, for example results of statistics, chemical information, feature intensities, etc..

strings_in_colnames_to_remove

a character vector of length 1 or of the same length of the data frames in results_list. For each of those, this string will be removed to consider together the samples. A typical example: c("_HILIC_pos", "_RP_neg", "_RP_pos").

by_column

NULL or a character vector of length 1 indicating a column name of the data frames. This column will be the reference used to treat duplicated, which will be ranked based on the if_duplicated_consider_columns argument.

if_duplicated_consider_columns

NULL or a character vector with column names of the data frames. Those columns must contain numerical or factor variables, and will serve to prioritize the row to keep in the combined data frame in case of duplicated in the column passed in by_column. The first column of if_duplicated_consider_columns will be considered, in case of tie, the second one, and so on.

decreasing

a logical vector of length 1 or of the same length of if_duplicated_consider_columns. For each of the columns passed in if_duplicated_consider_columns, the ranking order will be decreasing if TRUE, or increasing if FALSE.

name_new_column

character of length 1. A new column will be created in the merged table with this name, indicating the original data frame.

Value

A tibble with the combined results.