which_non_na | R Documentation |
Get indices of non-NA values
which_non_na(...)
... |
k vectors of the same length n, regarded as k columns with each n rows |
A list of n numerical vectors. Each numerical vector has a size between 0 and k and contains the indices of the vectors whose elements are not na in the corresponding row.
library(tibble) library(magrittr) library(dplyr) # Creates a list column containing (2,3);(3);(1,2,3) tibble(a=c(NA, NA, 2), b=c(4, NA, 5), c=c(1, 2, 3)) %>% mutate(non_na_idc=which_non_na(a, b, c))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.