Skip to content

Commit b9f1a14

Browse files
committed
use '.' prefix for internal objects in R/sysdata.rda
1 parent 998b4b9 commit b9f1a14

File tree

3 files changed

+13
-35
lines changed

3 files changed

+13
-35
lines changed

R/example-data.R

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ example_mcmc_draws <- function(chains = 4, params = 4) {
7474
chains >= 1 && chains <= 4,
7575
params >= 1 && params <= 6
7676
)
77-
.example_mcmc_draws(chains, params)
77+
x <- .ex_draws[, seq_len(chains), ]
78+
if (chains > 1) {
79+
x[, , seq_len(params), drop = FALSE]
80+
} else {
81+
x[, seq_len(params), drop = FALSE]
82+
}
7883
}
7984

8085

@@ -93,50 +98,23 @@ example_mcmc_draws <- function(chains = 4, params = 4) {
9398
#' dim(yrep) # ncol(yrep) = length(y) = length(x) = length(group)
9499
#'
95100
example_yrep_draws <- function() {
96-
.example_yrep_draws()
101+
.ex_yrep
97102
}
98103

99104
#' @rdname example-data
100105
#' @export
101106
example_y_data <- function() {
102-
.example_y_data()
107+
.ex_y
103108
}
104109

105110
#' @rdname example-data
106111
#' @export
107112
example_x_data <- function() {
108-
.example_x_data()
113+
.ex_x
109114
}
110115

111116
#' @rdname example-data
112117
#' @export
113118
example_group_data <- function() {
114-
.example_group_data()
115-
}
116-
117-
118-
# internal ----------------------------------------------------------------
119-
.example_y_data <- function() {
120-
# ex_y is stored internally in R/sysdata.rda
121-
return(ex_y)
122-
}
123-
.example_x_data <- function() {
124-
# ex_x is stored internally in R/sysdata.rda
125-
return(ex_x)
126-
}
127-
.example_group_data <- function() {
128-
# ex_group is stored internally in R/sysdata.rda
129-
return(ex_group)
130-
}
131-
.example_yrep_draws <- function() {
132-
# ex_yrep is stored internally in R/sysdata.rda
133-
return(ex_yrep)
134-
}
135-
.example_mcmc_draws <- function(chains, params) {
136-
# ex_draws is stored internally in R/sysdata.rda
137-
x <- ex_draws[, seq_len(chains), ]
138-
if (chains > 1)
139-
x[, , seq_len(params), drop = FALSE]
140-
else
141-
x[, seq_len(params), drop = FALSE]
119+
.ex_group
142120
}

R/helpers-ppc.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,19 +455,19 @@ interpolate_gamma <- function(N, K, prob, L) {
455455
#' @noRd
456456
get_interpolation_values <- function(N, K, L, prob) {
457457
for (dim in c("L", "prob")) {
458-
if (all(get(dim) != gamma_adj[, dim])) {
458+
if (all(get(dim) != .gamma_adj[, dim])) {
459459
stop(paste(
460460
"No precomputed values to interpolate from for '", dim, "' = ",
461461
get(dim),
462462
".\n",
463463
"Values of '", dim, "' available for interpolation: ",
464-
paste(unique(gamma_adj[, dim]), collapse = ", "),
464+
paste(unique(.gamma_adj[, dim]), collapse = ", "),
465465
".",
466466
sep = ""
467467
))
468468
}
469469
}
470-
vals <- gamma_adj[gamma_adj$L == L & gamma_adj$prob == prob, ]
470+
vals <- .gamma_adj[.gamma_adj$L == L & .gamma_adj$prob == prob, ]
471471
if (N > max(vals$N)) {
472472
stop(paste(
473473
"No precomputed values to interpolate from for sample length of ",

R/sysdata.rda

284 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)