Handle NA values in a numeric matrix
Usage
handle_na_values(
  x,
  idesign,
  handle_na = c("full1", "full", "partial", "none", "all"),
  na_value = 0,
  na_weight = 0,
  return_weights = FALSE,
  verbose = FALSE,
  ...
)Arguments
- x
 numericmatrix- idesign
 numericmatrix withrownames(idesign)equal tocolnames(x), containing0or1to fill the design matrix.- handle_na
 characterstring to determine the method used to handle NA values inx.- na_value
 numericorNAused to handle NA values.- na_weight
 numericweight between0and1used forNAvalues in the weight matrix, used whenreturn_weights=TRUE.- return_weights
 logicalindicating whether to include a weight matrix as an attribute with name"weights".- verbose
 logicalindicating whether to print verbose output.- ...
 additional arguments are ignored.
Value
numeric matrix with equal dimensions as input x,
where NA values have been handled as defined by handle_na.
Details
This function provides reasonable alternatives intended to
manage the presence of missing data encoded as NA values
in a numeric matrix.
The alternatives are defined by argument handle_na:
"full": RetainNAvalues, except when an entire group isNAit is replaced withna_value. This option is intended for sparse data where non-NA values are accepted as real measurements for each group, and where a group with all NA values should be retained for statistical contrasts by assigningna_value. This method essentially keeps the data as-is, except when groups are otherwise entirelyNAthe valuena_valueis used in order to retain any relevant contrasts that involve this group."full1": Similar to"full", retainNAvalues, except when an entire group isNA, then replace only one entry withna_value. This option is intended to keep data as-is, except to retain groups that are otherwise entirelyNA. In these groups, only onena_valueis used in order to prevent the group from contributing toward group variability or dispersion calculations."partial": ReplaceNAvalues withna_value, except when an entire group isNAthe entire group is kept atNA."all": Replace allNAvalues withna_value."none": Perform no replacement ofNAvalues.
See also
Other jamses stats: 
ebayes2dfs(),
format_hits(),
hit_array_to_list(),
process_sestats_to_hitim(),
run_limma_replicate(),
save_sestats(),
se_contrast_stats(),
sestats_to_dfs(),
sestats_to_df(),
voom_jam()