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