R/import.R

Defines functions blg_source_value

Documented in blg_source_value

#' Collect only the 'value' from the `source()` function.
#'
#' An explicit and easy-to-understand method of extracting
#' the value from the `source()` function.
#'
#' @param file A `.R` file to source into the environment.
#' @export

blg_source_value <- function(file) {
  stopifnot(file.exists(file))
  value <- source(file, echo = FALSE)
  value <- value["value"][[1]]
}
seasmith/blg documentation built on May 29, 2019, 12:40 p.m.