R/scdf_attr.R

Defines functions scdf_attr

Documented in scdf_attr

#' Set and get scdf attributes
#'
#' @param x Variable
#' @param var Attribute
#'
#' @return Attribute value
#' @export
scdf_attr <- function(x, var) {
  out <- attr(x, .opt$scdf)
  out[[var]]
}

#' @rdname scdf_attr
#' @param value set value
#' @export
"scdf_attr<-" <- function(x, var, value) {
  scdf_attr <- attr(x, .opt$scdf)
  if (is.null(scdf_attr)) scdf_attr <- list()
  
  scdf_attr[[var]] <- value
  attr(x, .opt$scdf) <- scdf_attr
  x
}

Try the scan package in your browser

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

scan documentation built on Feb. 12, 2021, 3:01 a.m.