get_all_na_rows {fabR}R Documentation

Extract columns that are all 'NA' from a tibble

Description

This helper function extracts the names of the columns in a tibble having NA values for all observations.

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 columns or the names of the empty columns.

Examples

{

##### Example 1 -------------------------------------------------------------
# All rows have observation
get_all_na_cols(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(bind_rows(iris, tibble(Species =  c('an_id', 'another_id'))),
                id_col = 'Species')

}


[Package fabR version 1.1.1 Index]