This helper function extracts the row number(s) having NA value for all columns.

get_all_na_rows(tbl, id_col = NULL)

Arguments

tbl

R object(dataframe or tibble) of the input tibble

id_col

A character string specifying the column to ignore in identification of repeated observations. If NULL (by default), all of the columns will be taken in account for repeated observation identification. The row number will be used to identify those observations.

Value

A vector string indicating either that the tibble does not have empty observation or the row number of the empty observations.

Examples

{

##### Example 1 -------------------------------------------------------------
# All rows have observation
get_all_na_rows(iris)

##### Example 2 -------------------------------------------------------------
# One row doesn't have any observations
library(dplyr)
get_all_na_rows(bind_rows(iris, tibble(Species = c(NA,NA))))
get_all_na_rows(
  tbl = bind_rows(iris, tibble(Species =  c('id_151', 'id_152'))),
  id_col = 'Species')

}
#> # A tibble: 2 × 2
#>   condition         row_number
#>   <chr>             <chr>     
#> 1 Empty observation id_151    
#> 2 Empty observation id_152