R/extend_UDS.R
remove_empty_rows.Rd
Removes empty rows (rows with all NAs) from a data frame
remove_empty_rows(df, vars)
A data frame
The variables to select
The original data frame, with the empty rows for the variables selected removed
df <- data.frame(a = c(1,2,3,NA, 5), b = c(NA,1,2,NA, 3), c = 1:5)
remove_empty_rows(df, a:b)
#> a b c
#> 1 1 NA 1
#> 2 2 1 2
#> 3 3 2 3
#> 4 5 3 5
# Different from
na.omit(df)
#> a b c
#> 2 2 1 2
#> 3 3 2 3
#> 5 5 3 5