[Rd] na.omit inconsistent with is.na on list

Toby Hocking tdhock5 @end|ng |rom gm@||@com
Thu Aug 12 06:58:33 CEST 2021


na.omit is documented as "na.omit returns the object with incomplete cases
removed." and "At present these will handle vectors," so I expected that
when it is used on a list, it should return the same thing as if we subset
via is.na; however I observed the following,

> L <- list(NULL, NA, 0)
> str(L[!is.na(L)])
List of 2
 $ : NULL
 $ : num 0
> str(na.omit(L))
List of 3
 $ : NULL
 $ : logi NA
 $ : num 0

Should na.omit be fixed so that it returns a result that is consistent with
is.na? I assume that is.na is the canonical definition of what should be
considered a missing value in R.

	[[alternative HTML version deleted]]



More information about the R-devel mailing list