Skip to content

Commit c8d6492

Browse files
author
gowerc
committed
Added coercion generics
1 parent 1b45e70 commit c8d6492

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed

NAMESPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ S3method(as_draws,CmdStanMCMC)
66
S3method(as_draws,CmdStanMLE)
77
S3method(as_draws,CmdStanPathfinder)
88
S3method(as_draws,CmdStanVB)
9+
export(as.CmdStanDiagnose)
10+
export(as.CmdStanGQ)
11+
export(as.CmdStanLaplace)
12+
export(as.CmdStanMCMC)
13+
export(as.CmdStanMLE)
14+
export(as.CmdStanPathfinder)
15+
export(as.CmdStanVB)
916
export(as_cmdstan_fit)
1017
export(as_draws)
1118
export(as_mcmc.list)

R/generics.R

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
#' Coercion methods for CmdStan objects
3+
#'
4+
#' These methods are used to coerce objects into `cmdstanr` objects.
5+
#' Primarily intended for other packages to use when interfacing
6+
#' with `cmdstanr`.
7+
#'
8+
#' @param object to be coerced
9+
#' @param ... additional arguments
10+
#'
11+
#' @name cmdstan_coercion
12+
NULL
13+
14+
#' @rdname cmdstan_coercion
15+
#' @export
16+
as.CmdStanMCMC <- function(object, ...) {
17+
UseMethod("as.CmdStanMCMC")
18+
}
19+
20+
#' @rdname cmdstan_coercion
21+
#' @export
22+
as.CmdStanMLE <- function(object, ...) {
23+
UseMethod("as.CmdStanMLE")
24+
}
25+
26+
#' @rdname cmdstan_coercion
27+
#' @export
28+
as.CmdStanLaplace <- function(object, ...) {
29+
UseMethod("as.CmdStanLaplace")
30+
}
31+
32+
#' @rdname cmdstan_coercion
33+
#' @export
34+
as.CmdStanVB <- function(object, ...) {
35+
UseMethod("as.CmdStanVB")
36+
}
37+
38+
#' @rdname cmdstan_coercion
39+
#' @export
40+
as.CmdStanPathfinder <- function(object, ...) {
41+
UseMethod("as.CmdStanPathfinder")
42+
}
43+
44+
#' @rdname cmdstan_coercion
45+
#' @export
46+
as.CmdStanGQ <- function(object, ...) {
47+
UseMethod("as.CmdStanGQ")
48+
}
49+
50+
#' @rdname cmdstan_coercion
51+
#' @export
52+
as.CmdStanDiagnose <- function(object, ...) {
53+
UseMethod("as.CmdStanDiagnose")
54+
}

man/cmdstan_coercion.Rd

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)