poissonconsulting / nlist

An R package to create and check numeric list objects
https://poissonconsulting.github.io/nlist/
Other
6 stars 1 forks source link

Add as_mcmc and as_mcmc_list wrappers on as.mcmc and as.mcmc.list #13

Closed joethorley closed 4 years ago

joethorley commented 4 years ago

but

> as_mcmc(nlist(x = matrix(1:6, 2)))
Error in UseMethod("as.mcmc") : 
  no applicable method for 'as.mcmc' applied to an object of class "nlist"
joethorley commented 4 years ago

Tried

#' Coerce to an mcmc Object
#' 
#' A wrapper on as.mcmc.
#' @export
#' @examples
#' as_mcmc(nlist(x = matrix(1:6, 2)))
#' as_mcmc(nlists(
#'   nlist(x = matrix(1:6, 2)),
#'   nlist(x = matrix(3:8, 2))
#' ))
as_mcmc <- function(x, ...) {
  UseMethod("as.mcmc")
}
joethorley commented 4 years ago

actually deprecated as.mcmc and as.mcmc.list for as_mcmc and as_mcmc_list