impute.Rd
Replaces missing values of a matrix or dataframe with the
medians (what="median"
) or means (what="mean"
) of the
respective columns.
impute(x, what = c("median", "mean"))
x | A matrix or dataframe. |
---|---|
what | What to impute. |
A matrix or dataframe.
#> [,1] [,2] #> [1,] NA 6 #> [2,] 2 NA #> [3,] NA 8 #> [4,] 4 9 #> [5,] 5 10#> [,1] [,2] #> [1,] 4 6.0 #> [2,] 2 8.5 #> [3,] 4 8.0 #> [4,] 4 9.0 #> [5,] 5 10.0