drop_na
drops entries by specified columns.
delete_na
deletes rows or columns with too many NAs.
drop_na(.data, ...)
delete_na(.data, MARGIN, n)
A data.table
x = data.table(x = c(1, 2, NA, 3), y = c(NA, NA, 4, 5),z = rep(NA,4))
x
#> x y z
#> <num> <num> <lgcl>
#> 1: 1 NA NA
#> 2: 2 NA NA
#> 3: NA 4 NA
#> 4: 3 5 NA
x %>% delete_na(2,0.75)
#> x y
#> <num> <num>
#> 1: 1 NA
#> 2: 2 NA
#> 3: NA 4
#> 4: 3 5
x = data.table(x = c(1, 2, NA, 3), y = c(NA, NA, 4, 5),z = rep(NA,4))
x %>% delete_na(2,0.5)
#> x
#> <num>
#> 1: 1
#> 2: 2
#> 3: NA
#> 4: 3
x = data.table(x = c(1, 2, NA, 3), y = c(NA, NA, 4, 5),z = rep(NA,4))
x %>% delete_na(2,0.24)
#> Null data.table (0 rows and 0 cols)
x = data.table(x = c(1, 2, NA, 3), y = c(NA, NA, 4, 5),z = rep(NA,4))
x %>% delete_na(2,2)
#> x
#> <num>
#> 1: 1
#> 2: 2
#> 3: NA
#> 4: 3
x = data.table(x = c(1, 2, NA, 3), y = c(NA, NA, 4, 5),z = rep(NA,4))
x %>% delete_na(1,0.6)
#> x y z
#> <num> <num> <lgcl>
#> 1: 3 5 NA
x = data.table(x = c(1, 2, NA, 3), y = c(NA, NA, 4, 5),z = rep(NA,4))
x %>% delete_na(1,2)
#> x y z
#> <num> <num> <lgcl>
#> 1: 3 5 NA