Skip to content

Commit 2ba0c5c

Browse files
committed
fixed documentation
1 parent 49574b4 commit 2ba0c5c

File tree

4 files changed

+68
-7
lines changed

4 files changed

+68
-7
lines changed

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export(sccomp_remove_outliers)
2626
export(sccomp_remove_unwanted_effects)
2727
export(sccomp_remove_unwanted_variation)
2828
export(sccomp_replicate)
29+
export(sccomp_stan_models_cache_dir)
2930
export(sccomp_test)
3031
export(sccomp_theme)
31-
export(sccomp_stan_models_cache_dir)
3232
export(simulate_data)
3333
import(dplyr)
3434
import(ggplot2)

R/utilities.R

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,35 @@
11
# Define global variable
22
# sccomp_stan_models_cache_dir = file.path(path.expand("~"), ".sccomp_models", packageVersion("sccomp"))
33

4-
# Function to get cache directory
5-
#' @importFrom utils packageVersion
6-
get_sccomp_cache_dir <- function() {
7-
file.path(path.expand("~"), ".sccomp_models", packageVersion("sccomp"))
8-
}
4+
95

106
# Define global variable (without version - version will be added in load_model when needed)
7+
#' Default cache directory for Stan models
8+
#'
9+
#' A global variable that defines the default cache directory for Stan models used by the sccomp package.
10+
#' This directory is used to store compiled Stan models to avoid recompilation on subsequent runs.
11+
#'
12+
#' @details
13+
#' The cache directory is set to \code{~/.sccomp_models} by default. This location is used by
14+
#' various sccomp functions to store and retrieve compiled Stan models, improving performance
15+
#' by avoiding unnecessary recompilation of models that have already been compiled.
16+
#'
17+
#' Users can override this default by specifying a different cache directory in function calls
18+
#' that accept a \code{cache_stan_model} parameter.
19+
#'
20+
#' @return A character string containing the path to the default cache directory.
21+
#'
22+
#' @examples
23+
#' # View the default cache directory
24+
#' sccomp_stan_models_cache_dir
25+
#'
26+
#' # Use a custom cache directory in a function call
27+
#' # sccomp_estimate(data, cache_stan_model = "/path/to/custom/cache")
28+
#'
29+
#' @seealso
30+
#' \code{\link{sccomp_estimate}}, \code{\link{sccomp_replicate}}, \code{\link{clear_stan_model_cache}}
31+
#'
32+
#' @export
1133
sccomp_stan_models_cache_dir = file.path(path.expand("~"), ".sccomp_models")
1234

1335
#' Add attribute to abject

man/sccomp_stan_models_cache_dir.Rd

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

tests/testthat/test-cache_stan_model.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test_that("cache_stan_model parameter works correctly", {
3434
expect_true(dir.exists(expected_cache_dir))
3535

3636
# Test that default cache directory includes version
37-
default_cache <- sccomp:::get_sccomp_cache_dir()
37+
default_cache <- file.path(path.expand("~"), ".sccomp_models", packageVersion("sccomp"))
3838
expect_true(grepl(sccomp_version, default_cache))
3939

4040
# Clean up

0 commit comments

Comments
 (0)