Returns the first non-missing value from a vector, useful for data cleaning and summarization tasks.
Examples
x <- c(NA, NA, 3, 4, 5)
first_non_na(x) # Returns 3
#> [1] 3
#> attr(,"na.action")
#> [1] 1 2
#> attr(,"class")
#> [1] "omit"
Returns the first non-missing value from a vector, useful for data cleaning and summarization tasks.
x <- c(NA, NA, 3, 4, 5)
first_non_na(x) # Returns 3
#> [1] 3
#> attr(,"na.action")
#> [1] 1 2
#> attr(,"class")
#> [1] "omit"