Hi Toby,
Right, my point is that is.na being equivalent to "is an incomplete case"
is really only true for atomic vectors. I don't see it being the case for
lists, given what is.na does for lists. This is all just my opinion, but
that's my take: vec[!is.na(vec)] happens to be the same as na.omit(
To clarify, ?is.na docs say that 'na.omit' returns the object with
incomplete cases removed.
If we take is.na to be the definition of "incomplete cases" then a list
element with scalar NA is incomplete.
About the data.frame method, in my opinion it is highly
confusing/inconsistent for na.omit to ke
I understand what is.na does, the issue I have is that its task is not
equivalent to the conceptual task na.omit is doing, in my opinion, as
illustrated by what the data.frame method does.
Thus what i was getting at above about it not being clear that lst[is.na(lst)]
being the correct thing for na
Some relevant information from ?is.na: the behavior for lists is
documented,
For is.na, elementwise the result is false unless that element
is a length-one atomic vector and the single element of that
vector is regarded as NA or NaN (note that any is.na method
for the class of
The data.frame method deliberately skips non-atomic columns before
invoking is.na(x) so I think it is fair to assume this behaviour is
intentional and assumed.
Not so clear to me that there is a sensible answer for list columns.
(List columns seem to collide with the expectation that in each
varia
On Thu, 12 Aug 2021 at 22:20, Gabriel Becker wrote:
>
> Hi Toby,
>
> This definitely appears intentional, the first expression of
> stats:::na.omit.default is
>
>if (!is.atomic(object))
>
> return(object)
I don't follow your point. This only means that the *default* method
is not int
On Thu, Aug 12, 2021 at 4:30 PM Toby Hocking wrote:
> Hi Gabe thanks for the feedback.
>
> On Thu, Aug 12, 2021 at 1:19 PM Gabriel Becker
> wrote:
>
>> Hi Toby,
>>
>> This definitely appears intentional, the first expression of
>> stats:::na.omit.default is
>>
>>if (!is.atomic(object))
>>
>
Hi Gabe thanks for the feedback.
On Thu, Aug 12, 2021 at 1:19 PM Gabriel Becker
wrote:
> Hi Toby,
>
> This definitely appears intentional, the first expression of
> stats:::na.omit.default is
>
>if (!is.atomic(object))
>
> return(object)
>
> Based on this code it does seem that the
Hi Toby,
This definitely appears intentional, the first expression of
stats:::na.omit.default is
if (!is.atomic(object))
return(object)
So it is explicitly just returning the object in non-atomic cases, which
includes lists. I was not involved in this decision (obviously) but my
gu
Also, the na.omit method for data.frame with list column seems to be
inconsistent with is.na,
> L <- list(NULL, NA, 0)
> str(f <- data.frame(I(L)))
'data.frame': 3 obs. of 1 variable:
$ L:List of 3
..$ : NULL
..$ : logi NA
..$ : num 0
..- attr(*, "class")= chr "AsIs"
> is.na(f)
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
11 matches
Mail list logo