Rの欠損値

Rの欠損値


○ NA と NaN の違い
NAはクラスの一つ(class attribute もつ)。
NaNはクラスでない。


NA values have a class also, so there are integer NA, character NA, etc.
A NaN value is also NA but the converse is not true


○ 値のあるもののみ (NAでないもの)
complete.cases ()
data frame, vector を引数にとれる。


is.na ()
vectorを引数にとれる。


○ 値のあるもののみ計算する
median(x, rm.ra=TRUE )
mean(x, rm.ra=TRUE )
などとする。