📄 na.roughfix.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Rough Imputation of Missing Values</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>
<table width="100%" summary="page for na.roughfix {randomForest}"><tr><td>na.roughfix {randomForest}</td><td align="right">R Documentation</td></tr></table>
<h2>Rough Imputation of Missing Values</h2>
<h3>Description</h3>
<p>
Impute Missing Values by median/mode.
</p>
<h3>Usage</h3>
<pre>
na.roughfix(object, ...)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>object</code></td>
<td>
a data frame or numeric matrix.</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
further arguments special methods could require.</td></tr>
</table>
<h3>Value</h3>
<p>
A completed data matrix or data frame. For numeric variables,
<code>NA</code>s are replaced with column medians. For factor variables,
<code>NA</code>s are replaced with the most frequent levels (breaking ties
at random). If <code>object</code> contains no <code>NA</code>s, it is returned
unaltered.</p>
<h3>Note</h3>
<p>
This is used as a starting point for imputing missing values by random
forest.
</p>
<h3>Author(s)</h3>
<p>
Andy Liaw
</p>
<h3>See Also</h3>
<p>
<code><a href="rfImpute.html">rfImpute</a></code>, <code><a href="randomForest.html">randomForest</a></code>.
</p>
<h3>Examples</h3>
<pre>
data(iris)
iris.na <- iris
set.seed(111)
## artificially drop some data values.
for (i in 1:4) iris.na[sample(150, sample(20)), i] <- NA
iris.roughfix <- na.roughfix(iris.na)
iris.narf <- randomForest(Species ~ ., iris.na, na.action=na.roughfix)
print(iris.narf)
</pre>
<hr><div align="center">[Package <em>randomForest</em> version 4.5-27 <a href="00Index.html">Index]</a></div>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -