get_all_na_rows: Extract observations (rows) that have all NA values in a...

get_all_na_rowsR Documentation

Extract observations (rows) that have all NA values in a tibble

Description

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

Usage

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')

}


fabR documentation built on May 29, 2024, 2:58 a.m.