Skip to contents

Apply function requiring a matrix to tidy table

Usage

apply_to_response_matrix(lfqdata, .func, .funcname = NULL)

Arguments

lfqdata

LFQData object

.func

function taking and returning a matrix

.funcname

name of function (used for creating new column)

Value

list with `data` (data.frame) and `colname` (new column name)

Examples


bb <- sim_lfq_data_peptide_config(Nprot = 100)
#> creating sampleName from file_name column
#> completing cases
#> completing cases done
#> setup done
lfqdata <- LFQData$new(bb$data, bb$config)
res <- apply_to_response_matrix(lfqdata, .func = base::scale)
#> Joining with `by = join_by(sampleName, isotopeLabel, protein_Id, peptide_Id)`
stopifnot("abundance_base..scale" %in% colnames(res$data))

res <- apply_to_response_matrix(lfqdata, .func = robust_scale)
#> Joining with `by = join_by(sampleName, isotopeLabel, protein_Id, peptide_Id)`

if (require("vsn")) {
  res <- apply_to_response_matrix(lfqdata, .func = vsn::justvsn)
}
#> Joining with `by = join_by(sampleName, isotopeLabel, protein_Id, peptide_Id)`