Skip to content

consider replace_na_with functions #129

Closed

Description

@njtierney

The creation of the replace_with_na functions has been nice - and the scoped variants (_at, _if, and _all) have been useful.

I think it would be useful to have functions that go the other way - from NA to a value.

This could be called replace_na_with - to provide a more direct complement to replace_with_na.

This is of interest to users, see this SO question

This could be written something like this:

replace_na_with <- function(vars, value) mutate_at(vars, funs(replace(., is.na(.), value)))

Activity

  1. HughParsonage commented on Jan 28, 2018

    @HughParsonage

    Extant functions include dplyr::coalesce and hutils::coalesce (by me).

  2. added this to the V0.3.0 milestone on Jun 5, 2018
  3. modified the milestones: V0.3.0, V0.4.0 on Jun 5, 2018
  4. modified the milestones: V0.4.0, V0.5.0 on Aug 31, 2018
  5. modified the milestones: V0.5.0, V0.6.0 on Oct 30, 2019
  6. modified the milestones: V0.6.0, V0.7.0 on Oct 14, 2022
  7. njtierney commented on Apr 23, 2023

    @njtierney
    OwnerAuthor

    We should re-export coalesce and provide documentation on how to use it, alongside the replace_with_na function

  8. added a commit that references this issue on May 3, 2023
    0031cc8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions