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
numeric
matrix- idesign
numeric
matrix withrownames(idesign)
equal tocolnames(x)
, containing0
or1
to fill the design matrix.- handle_na
character
string to determine the method used to handle NA values inx
.- na_value
numeric
orNA
used to handle NA values.- na_weight
numeric
weight between0
and1
used forNA
values in the weight matrix, used whenreturn_weights=TRUE
.- return_weights
logical
indicating whether to include a weight matrix as an attribute with name"weights"
.- verbose
logical
indicating 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"
: RetainNA
values, except when an entire group isNA
it 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 entirelyNA
the valuena_value
is used in order to retain any relevant contrasts that involve this group."full1"
: Similar to"full"
, retainNA
values, 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_value
is used in order to prevent the group from contributing toward group variability or dispersion calculations."partial"
: ReplaceNA
values withna_value
, except when an entire group isNA
the entire group is kept atNA
."all"
: Replace allNA
values withna_value
."none"
: Perform no replacement ofNA
values.
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()