rm_empty_block: Remove rows where all specified variables are missing

rm_empty_blockR Documentation

Remove rows where all specified variables are missing

Description

It is common to want to remove cases/rows where all variables in a particular set are missing, e.g. all symptom variables are missing in a health care dataset.

Usage

rm_empty_block(.data, ...)

Arguments

.data

Dataframe.

...

Unquoted variable/column names.

Value

Data frame.

Examples

# Pretend that we want to remove rows that are missing in group1, group2, and group3 
# but keep rest of dataset. 
colon_s %>% 
  dplyr::mutate(
    group1 = rep(c(NA, 1), length.out = 929),
    group2 = rep(c(NA, 1), length.out = 929),
	 group3 = rep(c(NA, 1), length.out = 929)
  ) %>% 
rm_empty_block(group1, group2, group3) %>% 
  head()

finalfit documentation built on Nov. 17, 2023, 1:09 a.m.