src/library/jsonlite/R/is.scalarlist.R

is_scalarlist_r <- function(x) {
  if(!is.list(x)) return(FALSE)
  for(i in x){
    if(!is.atomic(i) || length(i) > 1) return(FALSE)
  }
  return(TRUE)
}

#' @useDynLib jsonlite C_is_scalarlist
is_scalarlist_c <- function(x){
  .Call(C_is_scalarlist, x)
}

is.scalarlist <- is_scalarlist_c;
r-lib/pkgman documentation built on Nov. 18, 2024, 2:23 p.m.