R/set-pars.R

Defines functions set_pars.mcmcrs set_pars.mcmcr set_pars.character

Documented in set_pars.mcmcr set_pars.mcmcrs

#' @importFrom universals set_pars
#' @export
universals::set_pars

#' @importFrom universals pars<-
#' @export
universals::`pars<-`

#' @export
set_pars.character <- function(x, value, ...) {
  x <- as_term(x)
  pars(x) <- value
  as.character(x)
}

#' @inherit universals::set_pars
#' @export
set_pars.mcmcr <- function(x, value, ...) {
  chk_pars(value)
  chk_identical(length(value), length(x))
  names(x) <- value
  x
}

#' @inherit universals::set_pars
#' @export
set_pars.mcmcrs <- function(x, value, ...) {
  x <- lapply(x, `pars<-`, value, ...)
  class(x) <- "mcmcrs"
  x
}

Try the mcmcr package in your browser

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

mcmcr documentation built on Sept. 7, 2021, 1:07 a.m.