Skip to content

Commit e9e164a

Browse files
committed
Use exportS3Method NULL for S3 methods
1 parent b428fa2 commit e9e164a

7 files changed

Lines changed: 22 additions & 20 deletions

File tree

R/jm_make_assoc_terms.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ get_element <- function(parts, m = 1, which = "eta", ...) {
392392
collapse_within_groups <- function(eta, grp_idx, grp_assoc = "sum") {
393393
UseMethod("collapse_within_groups")
394394
}
395-
#' @noRd
395+
#' @exportS3Method NULL
396396
collapse_within_groups.default <- function(eta, grp_idx, grp_assoc) {
397397
N <- nrow(grp_idx)
398398
val <- rep(NA, N)
@@ -402,7 +402,7 @@ collapse_within_groups.default <- function(eta, grp_idx, grp_assoc) {
402402
}
403403
val
404404
}
405-
#' @noRd
405+
#' @exportS3Method NULL
406406
collapse_within_groups.matrix <- function(eta, grp_idx, grp_assoc) {
407407
N <- nrow(grp_idx)
408408
val <- matrix(NA, nrow = nrow(eta), ncol = N)

R/log_lik.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ ll_fun <- function(x, m = NULL) {
202202
# N = number of observations
203203
#' @noRd
204204
ll_args <- function(object, ...) UseMethod("ll_args")
205-
#' @noRd
205+
#' @exportS3Method NULL
206206
ll_args.stanreg <- function(object, newdata = NULL, offset = NULL, m = NULL,
207207
reloo_or_kfold = FALSE, ...) {
208208
validate_stanreg_object(object)
@@ -513,7 +513,7 @@ ll_args.stanreg <- function(object, newdata = NULL, offset = NULL, m = NULL,
513513
# @param pars Output from extract_pars
514514
# @param m Integer specifying which submodel
515515
# @param reloo_or_kfold logical. TRUE if ll_args is for reloo or kfold
516-
#' @noRd
516+
#' @exportS3Method NULL
517517
ll_args.stanjm <- function(object, data, pars, m = 1,
518518
reloo_or_kfold = FALSE, ...) {
519519
validate_stanjm_object(object)
@@ -871,7 +871,7 @@ evaluate_log_survival <- function(log_haz, qnodes, qwts) {
871871
UseMethod("evaluate_log_survival")
872872
}
873873

874-
#' @noRd
874+
#' @exportS3Method NULL
875875
evaluate_log_survival.default <- function(log_haz, qnodes, qwts) {
876876
# convert log hazard to hazard
877877
haz <- exp(log_haz)
@@ -884,7 +884,7 @@ evaluate_log_survival.default <- function(log_haz, qnodes, qwts) {
884884
-cum_haz
885885
}
886886

887-
#' @noRd
887+
#' @exportS3Method NULL
888888
evaluate_log_survival.matrix <- function(log_haz, qnodes, qwts) {
889889
# convert log hazard to hazard
890890
haz <- exp(log_haz)

R/loo-prediction.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ loo_predictive_interval.stanreg <-
155155

156156
# internal ----------------------------------------------------------------
157157

158-
#' @noRd
158+
#' @exportS3Method NULL
159159
psis.stanreg <- function(log_ratios, ...) {
160160
object <- log_ratios
161161
message("Running PSIS to compute weights...")

R/misc.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -549,15 +549,15 @@ set_prior_scale <- function(scale, default, link) {
549549
linear_predictor <- function(beta, x, offset = NULL) {
550550
UseMethod("linear_predictor")
551551
}
552-
#' @noRd
552+
#' @exportS3Method NULL
553553
linear_predictor.default <- function(beta, x, offset = NULL) {
554554
eta <- as.vector(if (NCOL(x) == 1L) x * beta else x %*% beta)
555555
if (length(offset))
556556
eta <- eta + offset
557557

558558
return(eta)
559559
}
560-
#' @noRd
560+
#' @exportS3Method NULL
561561
linear_predictor.matrix <- function(beta, x, offset = NULL) {
562562
if (NCOL(beta) == 1L)
563563
beta <- as.matrix(beta)
@@ -633,24 +633,24 @@ get_z.stanmvreg <- function(object, m = NULL, ...) {
633633
# @param x A stanreg object, family object, or string.
634634
# @param ... Other arguments passed to methods. For a \code{stanmvreg} object
635635
# this can be an integer \code{m} specifying the submodel.
636-
# @return The inverse link function associated with x.
636+
# @return The inverse link function associated with x
637637
#' @noRd
638638
linkinv <- function(x, ...) UseMethod("linkinv")
639-
#' @noRd
639+
#' @exportS3Method NULL
640640
linkinv.stanreg <- function(x, ...) {
641641
if (is(x, "polr")) polr_linkinv(x) else family(x)$linkinv
642642
}
643-
#' @noRd
643+
#' @exportS3Method NULL
644644
linkinv.stanmvreg <- function(x, m = NULL, ...) {
645645
ret <- lapply(family(x), `[[`, "linkinv")
646646
stub <- get_stub(x)
647647
if (!is.null(m)) ret[[m]] else list_nms(ret, stub = stub)
648648
}
649-
#' @noRd
649+
#' @exportS3Method NULL
650650
linkinv.family <- function(x, ...) {
651651
x$linkinv
652652
}
653-
#' @noRd
653+
#' @exportS3Method NULL
654654
linkinv.character <- function(x, ...) {
655655
stopifnot(length(x) == 1)
656656
polr_linkinv(x)

R/predictive_error.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ predictive_error.ppd <- function(object, y, ...) {
141141
# is available. The argument \code{u} specifies the time at which the
142142
# prediction error should be calculated (i.e. the time horizon).
143143
#
144-
#' @noRd
144+
#' @exportS3Method NULL
145145
predictive_error.stanmvreg <-
146146
function(object,
147147
newdataLong = NULL,

R/stan_glm.fit.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,16 +902,18 @@ pad_reTrms <- function(Ztlist, cnms, flist) {
902902
# stats)
903903
# @param columns Do the columns (TRUE) or rows (FALSE) correspond to the
904904
# variables?
905-
unpad_reTrms <- function(x, ...) UseMethod("unpad_reTrms")
905+
906906
#' @noRd
907+
unpad_reTrms <- function(x, ...) UseMethod("unpad_reTrms")
908+
#' @exportS3Method NULL
907909
unpad_reTrms.default <- function(x, ...) {
908910
if (is.matrix(x) || is.array(x))
909911
return(unpad_reTrms.array(x, ...))
910912
keep <- !grepl("_NEW_", names(x), fixed = TRUE)
911913
x[keep]
912914
}
913915

914-
#' @noRd
916+
#' @exportS3Method NULL
915917
unpad_reTrms.array <- function(x, columns = TRUE, ...) {
916918
ndim <- length(dim(x))
917919
if (ndim > 3)
@@ -945,7 +947,7 @@ make_b_nms <- function(group, m = NULL, stub = "Long") {
945947
levels(group$flist[[nm]])))))
946948
}
947949
}
948-
return(b_nms)
950+
return(b_nms)
949951
}
950952

951953

R/stanreg_list.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ stanreg_list_families <- function(mods) {
281281
rename_loos <- function(x,...) UseMethod("rename_loos")
282282

283283
# Change model_name attributes of a loo/waic/kfold object stored in a stanreg object,
284-
#' @noRd
284+
#' @exportS3Method NULL
285285
rename_loos.stanreg <- function(x, new_model_name,...) {
286286
for (criterion in c("loo", "waic", "kfold")) {
287287
if (!is.null(x[[criterion]])) {
@@ -293,7 +293,7 @@ rename_loos.stanreg <- function(x, new_model_name,...) {
293293

294294
# Change model_name attributes of loo/waic/kfold objects to correspond to
295295
# model names used for stanreg_list
296-
#' @noRd
296+
#' @exportS3Method NULL
297297
rename_loos.stanreg_list <- function(x, ...) {
298298
for (j in seq_along(x)) {
299299
x[[j]] <- rename_loos.stanreg(x[[j]], new_model_name = names(x)[j])

0 commit comments

Comments
 (0)