ライブラリe1071のimpute関数を使うと便利
library<span class="synSpecial">(</span>e1071<span class="synSpecial">)</span> data <span class="synStatement"><-</span> impute<span class="synSpecial">(</span>data<span class="synSpecial">,</span><span class="synConstant">"mean"</span><span class="synSpecial">)</span>