R/zzz.R

Defines functions dt checkforpkg fcmp pluck

pluck <- function(x, name, type) {
  if (missing(type)) {
    lapply(x, "[[", name)
  } else {
    vapply(x, "[[", name, FUN.VALUE = type)
  }
}

fcmp <- function(z) Filter(Negate(is.null), z)

checkforpkg <- function(x) {
  if (!requireNamespace(x, quietly = TRUE)) {
    stop("Please install ", x, call. = FALSE)
  } else {
    invisible(TRUE)
  }
}

dt <- function(x) {
  (data.table::setDF(data.table::rbindlist(x, use.names = TRUE, fill = TRUE)))
}

Try the finch package in your browser

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

finch documentation built on Aug. 11, 2020, 9:06 a.m.