View source: R/first-nonmissing.R
| first_nonmissing | R Documentation | 
Take the first value that isn't missing. Adapted from http://stackoverflow.com/a/40515261/1082435.
first_nonmissing(x, value_if_all_na = NULL, na_codes = NULL)
x | 
 A vector of values to collapse.  | 
value_if_all_na | 
 A scalar value to return if all elements are missing
(i.e., they are all either   | 
na_codes | 
 A vector of codes that represent missing values.  | 
value_if_all_na and na_codesmust have the same data type as x.
If value_if_all_na is null, then an NA will be returned.
If na_codes is null, then all non-NA values are considered.
A scalar of converted names.
Will Beasley
first_nonmissing(c(NA, "b", "c"))
first_nonmissing(c(NA_character_, NA_character_))
first_nonmissing(character(0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.