Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

include check_column_has_no_na in r2dii.utils #21

Open
jdhoffa opened this issue Mar 30, 2020 · 6 comments
Open

include check_column_has_no_na in r2dii.utils #21

jdhoffa opened this issue Mar 30, 2020 · 6 comments

Comments

@jdhoffa
Copy link
Member

jdhoffa commented Mar 30, 2020

I find myself using the following function frequently in r2dii.analysis to ensure that no crucial input columns contain any NA's:

check_column_has_no_na <- function(data, column) {
  if (anyNA(data[[column]])) {
    rlang::abort(
      class = "column_has_na",
      glue::glue("Column `{column}` must not contain any `NA`s.")
    )
  }

  invisible(data)
}
@maurolepore
Copy link
Collaborator

maurolepore commented Mar 30, 2020

Before working on this I would like to learn more about existing packages for assertions and discuss when to use them versus when to write custom assertions. It seems a great topic for a ds-incubator meetup (2DegreesInvesting/ds-incubator#11 (comment)), and maybe @vintented and @looreen might help lead it?

@cjyetman
Copy link
Member

I'm interested in this discussion, if it's still on the table. I've done a ton of this lately (custom assertions and error reporting).

@maurolepore
Copy link
Collaborator

Absolutely. You've been thinking a lot about 2DII's data and it'd be great to advertise your work and similar (e.g. https://cran.r-project.org/web/packages/assertr/vignettes/assertr.html).

What would be your preferred way to revive this conversation and engage our colleagues?

@cjyetman
Copy link
Member

At the moment, I'd be more interested in a discussion with some at least minimally informed people about this topic. I think by now I'm particularly aware of the main options available, but in my use case none of them met all of my needs. I'd be interested in hearing about other available options and/or other needs that other people have had that were not met by current options. I'm also happy to discuss my self-made implementation of this, what it does, why I needed it, and possibly how it could be generalized to meet other needs.... but also would be happy to find an alternative that someone else maintains.

In the long run I'd be happy to do/help with a presentation of learnings/decisions about this topic, but at the moment I feel like I'm more at the discussion phase. I did do a DS-incubator early last summer about using assertr, but I probably know a lot more about this by now. 😉

@maurolepore
Copy link
Collaborator

Good. How about starting with a call with whoever you think might help at this stage? I thought of starting a conversation in the "Discussions" tab of some repo -- but what repo should that be?

@cjyetman
Copy link
Member

Let's have a call and/or start a Slack channel early in the new year to start.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants