Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added coercion generics #943

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ S3method(as_draws,CmdStanMCMC)
S3method(as_draws,CmdStanMLE)
S3method(as_draws,CmdStanPathfinder)
S3method(as_draws,CmdStanVB)
export(as.CmdStanDiagnose)
export(as.CmdStanGQ)
export(as.CmdStanLaplace)
export(as.CmdStanMCMC)
export(as.CmdStanMLE)
export(as.CmdStanPathfinder)
export(as.CmdStanVB)
export(as_cmdstan_fit)
export(as_draws)
export(as_mcmc.list)
Expand Down
54 changes: 54 additions & 0 deletions R/generics.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

#' Coercion methods for CmdStan objects
#'
#' These methods are used to coerce objects into `cmdstanr` objects.
#' Primarily intended for other packages to use when interfacing
#' with `cmdstanr`.
#'
#' @param object to be coerced
#' @param ... additional arguments
#'
#' @name cmdstan_coercion
NULL

#' @rdname cmdstan_coercion
#' @export
as.CmdStanMCMC <- function(object, ...) {
UseMethod("as.CmdStanMCMC")
}

#' @rdname cmdstan_coercion
#' @export
as.CmdStanMLE <- function(object, ...) {
UseMethod("as.CmdStanMLE")
}

#' @rdname cmdstan_coercion
#' @export
as.CmdStanLaplace <- function(object, ...) {
UseMethod("as.CmdStanLaplace")
}

#' @rdname cmdstan_coercion
#' @export
as.CmdStanVB <- function(object, ...) {
UseMethod("as.CmdStanVB")
}

#' @rdname cmdstan_coercion
#' @export
as.CmdStanPathfinder <- function(object, ...) {
UseMethod("as.CmdStanPathfinder")
}

#' @rdname cmdstan_coercion
#' @export
as.CmdStanGQ <- function(object, ...) {
UseMethod("as.CmdStanGQ")
}

#' @rdname cmdstan_coercion
#' @export
as.CmdStanDiagnose <- function(object, ...) {
UseMethod("as.CmdStanDiagnose")
}
37 changes: 37 additions & 0 deletions man/cmdstan_coercion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading