calcData: helper function to calculate a row-wise function (like mean,...

View source: R/TMT.R

calcDataR Documentation

helper function to calculate a row-wise function (like mean, median etc) across a data.frame

Description

helper function to calculate a row-wise function (like mean, median etc) across a data.frame

Usage

calcData(
  data,
  setNAZero = NA,
  removeNAs = FALSE,
  keepData = FALSE,
  calcName = "median",
  calcFunc = stats::median,
  ...
)

Arguments

data

the data.frame. Note that all rows and columns are used, so selection, filtering, etc should be done beforehand

setNAZero

default = NA, when NA this is ignored. Otherwise all cells containing NA will be set to the value of setNAZero. When removeNAs = TRUE, this parameter is ignored

removeNAs

default = FALSE, if TRUE all rows containing NA's will be removed via na.omit()

keepData

if TRUE, then the original data is returned also

calcName

name of the column with the calculated values in it

calcFunc

function to be applied row-wise across the data.frame

...

serves to pass on "extra" arguments on to the calcFunc function, eg na.rm = TRUE in case of calcFunc = mean

Value

a data.frame with the calculated values as the only column or with the calculated values as a mew column


BenBruyneel/proteinDiscover documentation built on March 16, 2024, 4:36 p.m.