na.handling {siggenes}R Documentation

Handling of Missing Values

Description

Removes missing values from a data set either by replacing them or by removing the rows that contain missing values.

Usage

  na.handling(X, na.replace = TRUE, na.method = "mean")

Arguments

X a matrix
na.replace If TRUE, missing values are replaced by the rowwise statistic specified by na.method. If FALSE, all rows with one or more missing values are removed
na.method character string specifying the statistic with which the missing values should be replaced. Must be either "mean" or "median"

Details

Since missing values are replaced by either the rowwise mean or median, na.handling can only handle continuous data. There is, however, no check if the data is continuous or categorical/discrete.

If there are no or only one non-missing value in a row, na.handling will remove this row from the data set even if na.replace=TRUE.

Value

X matrix without missing values. The number of rows of X can differ from the number of rows of the input matrix X, since all rows with either less than one non-missing value (if na.replace=TRUE) or with at least one missing value (if na.replace=FALSE) are removed
NA.genes the rows of the input matrix X that are removed and thus are excluded from the output matrix X

Author(s)

Holger Schwender, holger.schw@gmx.de

See Also

na.replace.cont,na.replace.dist

Examples

   mat<-matrix(1:20,5,4)
   mat[1,2]<-NA
   mat
   
   # Replace the missing value by the mean of the first row.
   na.handling(mat)
   
   # Remove the first row.
   na.handling(mat,na.replace=FALSE)
   
   # Replace the missing value in the first row by the mean of
   # this row, and remove the second row containing only NAs.
   mat[2,]<-NA
   mat
   na.handling(mat)

[Package siggenes version 1.4.0 Index]