Skip to content

every() and NAs #174

Closed
Closed

Description

@kablag

I'm very impressed by purrr but from my point of view it's strange result:
every(NA, function(x) x > 0)
[1] FALSE
Doesn't it break R rules about NA?
Maybe it's better to return NA like all()?
all(c(NA) > 0)
[1] NA

Activity

  1. lionel- commented on Feb 7, 2016

    @lionel-
    Member

    hmm yes, we should probably return NA if one element of .x is NA. And with some(), we should do the same except if one element is TRUE.

  2. added
    bugan unexpected problem or unintended behavior
    on Mar 3, 2017
  3. hadley commented on Mar 3, 2017

    @hadley
    Member
    library(purrr)
    every(NA, ~ .x > 0)
    #> [1] FALSE
  4. added a commit that references this issue on Jan 10, 2025
    b26029d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions