darwin-eu / omopgenerics

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

create a function isTableEmpty #494

Closed catalamarti closed 1 month ago

catalamarti commented 2 months 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(...)