vec_detect_complete() detects "complete" observations. An observation is
considered complete if it is non-missing. For most vectors, this implies that
vec_detect_complete(x) == !vec_equal_na(x).
For data frames and matrices, a row is only considered complete if all
elements of that row are non-missing. To compare,
rows that are partially complete (they have at least one non-missing value).
A logical vector with the same size as
A record type vector is considered complete if any field is non-missing.
x <- c(1, 2, NA, 4, NA) # For most vectors, this is identical to `!vec_equal_na(x)` vec_detect_complete(x)#>  TRUE TRUE FALSE TRUE FALSE!vec_equal_na(x)#>  TRUE TRUE FALSE TRUE FALSE#> Warning: `data_frame()` was deprecated in tibble 1.1.0. #> Please use `tibble()` instead.# This returns `TRUE` where all elements of the row are non-missing. # Compare that with `!vec_equal_na()`, which detects rows that have at # least one non-missing value. df2 <- df df2$all_non_missing <- vec_detect_complete(df) df2$any_non_missing <- !vec_equal_na(df) df2#> # A tibble: 5 x 4 #> x y all_non_missing any_non_missing #> <dbl> <chr> <lgl> <lgl> #> 1 1 a TRUE TRUE #> 2 2 b TRUE TRUE #> 3 NA NA FALSE FALSE #> 4 4 d TRUE TRUE #> 5 NA e FALSE TRUE