darwin-eu-dev / omopgenerics

https://darwin-eu-dev.github.io/omopgenerics/
Apache License 2.0
2 stars 1 forks source link

create a function isTableEmpty #494

Closed catalamarti closed 3 weeks ago

catalamarti commented 3 weeks ago

In many places we have the following code:

if (x |>
      dplyr::ungroup() |>
      utils::head(1) |>
      dplyr::tally() |>
      dplyr::pull() == 0) {
}

We could have a simpler function:

if (omopgenerics::isTableEmpty(x)) return(...)