na_omit.Rd
Returns data object with NA values (if atomic vector), all NA elements (if list), or all NA rows (if data frame or matrix) omitted
na_omit(x)
x | Data object |
---|
Data with NA values (if atomic vector), all NA elements (if list), or all NA rows (if data frame or matrix) omitted.
## generate data df <- data.frame( a = I(list(c(1, 2), c(NA_integer_, NA_integer_), c(1, 2))), b = c("a", NA_character_, "c"), c = c(1.1243, NA_real_, -1.234134) ) ## data frame na_omit(df)#> Warning: longer object length is not a multiple of shorter object length#> Warning: longer object length is not a multiple of shorter object length#> Warning: longer object length is not a multiple of shorter object length#> a b c #> 1 1, 2 a 1.124300 #> 3 1, 2 c -1.234134#> Warning: longer object length is not a multiple of shorter object length#> Warning: longer object length is not a multiple of shorter object length#> Warning: longer object length is not a multiple of shorter object length#> a b c #> [1,] Numeric,2 "a" 1.1243 #> [2,] Numeric,2 "c" -1.234134#> Warning: longer object length is not a multiple of shorter object length#> Warning: longer object length is not a multiple of shorter object length#> Warning: longer object length is not a multiple of shorter object length#> [[1]] #> [[1]]$a #> [1] 1 2 #> #> [[1]]$b #> [1] "a" #> #> [[1]]$c #> [1] 1.1243 #> #> #> [[2]] #> [[2]]$a #> [1] 1 2 #> #> [[2]]$b #> [1] "c" #> #> [[2]]$c #> [1] -1.234134 #> #>## atomic vector na_omit(df$b)#> [1] a c #> Levels: a c