R/is_na_list.R

Defines functions is_na_list

Documented in is_na_list

#' @title Check whether a list contains NA or not.
#'
#' @param alist A list constructed by numeric vectors, which possibly contained in NAs.
#'
#' @return A logical, if list contains NA, then TRUE. And False for the others.
#' @export
#'
#' @examples
#'
#'#========================================================================================
#'#   If a list does not contain NAs, then return TRUE
#'#========================================================================================
#'
#'#'d <- list(a=c(1,1),aa = c(2,2),aaa =c(3,3,3))
#'is_na_list(d)
#'
#'
#'
#'
#'
#'
#'
#'
#'#========================================================================================
#'#   If a list contains NAs, then return TRUE
#'#========================================================================================
#'
#'d <- list(a=c(NA,1),aa = c(2,2),aaa =c(3,3,3))
#'is_na_list(d)
#'
#'
#'
#'
#'
#'#========================================================================================
#'#   Note that a data frame is a list of equal-length vectors
#'#========================================================================================
#'
#'d <- is_na_list(data.frame(c(1,1)))
#'is_na_list(d)
#'
#'
#'d <- is_na_list(data.frame(c(1,NA)))
#'is_na_list(d)
#'
#'
#'
#'
#'
#'
#'
#'
is_na_list <- function(alist){

  !as.logical(prod(!is.na(unlist(   alist   ))))

}
#
# d <- list(a=c(1,1),aa = c(2,2))
# is_na_list(d)
#
# d <- list(a=c(NA,1),aa = c(2,2))
# is_na_list(d)

Try the BayesianFROC package in your browser

Any scripts or data that you put into this service are public.

BayesianFROC documentation built on Jan. 23, 2022, 9:06 a.m.