Skip to content

Add a na.rm argument to first()/last() #4239

Description

@nbenn

Personally, I'd find it useful if gfirst()/glast() would accept a na.rm argument. This would then return the first/last non missing element of a vector (within each group).

For consistency I guess also first()/last() should then accept a na.rm argument. Although I'm not sure what this would mean if a non-atomic object (i.e. a data.frame) was passed. Maybe the flag should only be honored if is.atomic(x) && nargs() == 1L?

Activity

  1. ben-schwen commented on Sep 30, 2020

    @ben-schwen
    Member

    What should happen in cases, where a group contains no non NA element?

    Whats happens in other gfunctions for those groups?

    • gsum returns 0
    • gmedian, gvar and gsd return NA
    • gmean returns NaN
    • gprod returns 1
    • gmax/gmin return Inf
  2. added this to the 1.14.3 milestone on Dec 13, 2021
  3. modified the milestones: 1.14.3, on Jul 19, 2022
  4. modified the milestones: , 1.15.1 on Oct 29, 2023
  5. modified the milestones: 1.16.0, 1.17.0 on Jul 11, 2024
  6. modified the milestones: 1.17.0, 1.16.0 on Jul 30, 2024
  7. modified the milestones: 1.17.0, 1.18.0 on Dec 10, 2024
  8. modified the milestones: 1.18.0, 1.19.0 on Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions