Missing values are replaced either by the group mean for numeric metadata or the most frequent group value for categoric metadata. Missing values are only replaced if there are less missing values than the threshold in the group, else the metadata item concerned is removed. The output are metadata without missing values.

setNAToGroupMean(
  metadata.df,
  groups = c(),
  na.threshold = 4,
  metadata.to.skip = c()
)

Arguments

metadata.df

a data frame with metadata

groups

a vector that specifies the group for each sample

na.threshold

number of allowed missing values per group

metadata.to.skip

metadata for which filling with the group mean does not make sense (e.g. date)