Skip to content

Commit

Permalink
Merge pull request #29 from yjunechoe/1.1.2
Browse files Browse the repository at this point in the history
1.1.2
  • Loading branch information
yjunechoe committed Feb 18, 2024
2 parents 67bb725 + 7a41d9a commit 03ca7ca
Show file tree
Hide file tree
Showing 75 changed files with 178 additions and 147 deletions.
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.1.1
Date: 2024-02-07 17:45:58 UTC
SHA: c69f5c5308ae5c0c96d955d46d309231299f9c2f
Version: 1.1.2
Date: 2024-02-16 16:22:21 UTC
SHA: 7e7dcf69b9d37cbd43f3b4ddb63916019f3bb32b
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: jlmerclusterperm
Title: Cluster-Based Permutation Analysis for Densely Sampled Time Data
Version: 1.1.1
Version: 1.1.2
Authors@R:
person("June", "Choe", , "jchoe001@gmail.com", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0002-0701-921X"))
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# jlmerclusterperm 1.1.1
# jlmerclusterperm 1.1.2

- `jlmerclusterperm()` exposes a `cache_dir` argument for manually specifying the cache directory. This was added largely for the convenience of testing. The default value of `cache_dir = NULL` preserves old behavior.

Fixes for CRAN:

- Write cache to `tempdir()` for the purposes of running examples and tests.

# jlmerclusterperm 1.1.1

Expand Down
33 changes: 21 additions & 12 deletions R/aaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ julia_setup_ok <- function() {
#' Initial setup for the jlmerclusterperm package
#'
#' @param ... Ignored.
#' @param cache_dir The location to write out package cache files (namely, Manifest.toml).
#' If `NULL` (default), attempts to write to the package's cache directory discovered via
#' `R_user_dir()` and falls back to `tempdir()`.
#' @param restart Whether to set up a fresh Julia session, given that one is already running.
#' If `FALSE` and `jlmerclusterperm_setup()` has already been called, nothing happens.
#' @param verbose Print progress and messages from Julia in the console
#'
#' @examplesIf julia_setup_ok()
#' \donttest{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#'
#' \dontshow{
#' JuliaConnectoR::stopJulia()
Expand All @@ -58,22 +61,22 @@ julia_setup_ok <- function() {
#'
#' @export
#' @return TRUE
jlmerclusterperm_setup <- function(..., restart = TRUE, verbose = TRUE) {
jlmerclusterperm_setup <- function(..., cache_dir = NULL, restart = TRUE, verbose = TRUE) {
if (!JuliaConnectoR::juliaSetupOk()) cli::cli_abort("No Julia installation detected.")
if (!julia_version_compatible()) cli::cli_abort("Julia version >=1.8 required.")
if (restart || !is_setup()) {
JuliaConnectoR::stopJulia()
setup_with_progress(verbose = verbose)
setup_with_progress(cache_dir = cache_dir, verbose = verbose)
.jlmerclusterperm$is_setup <- TRUE
} else {
cli::cli_inform("Julia instance already running - skipping setup.")
}
invisible(TRUE)
}

setup_with_progress <- function(..., verbose = TRUE) {
setup_with_progress <- function(..., cache_dir = NULL, verbose = TRUE) {
start_with_threads(verbose = verbose)
set_projenv(verbose = verbose)
set_projenv(cache_dir = cache_dir, verbose = verbose)
source_jl(verbose = verbose)
define_globals()
cleanup_jl()
Expand All @@ -96,19 +99,25 @@ start_with_threads <- function(..., max_threads = 7L, verbose = TRUE) {
invisible(TRUE)
}

set_projenv <- function(..., verbose = TRUE) {
set_projenv <- function(..., cache_dir = NULL, verbose = TRUE) {
if (verbose) cli::cli_progress_step("Activating package environment")
pkgdir <- system.file("julia/", package = "jlmerclusterperm")
cachedir <- R_user_dir("jlmerclusterperm", which = "cache")
userdir <- if (dir.exists(dirname(cachedir))) cachedir else tempdir()
userdir <- if (!is.null(cache_dir)) {
cache_dir
} else {
pkg_cache_dir <- R_user_dir("jlmerclusterperm", which = "cache")
if (dir.exists(dirname(pkg_cache_dir))) pkg_cache_dir else tempdir()
}
projdir <- file.path(userdir, "julia")
manifest <- file.path(projdir, "Manifest.toml")
manifest_cached <- file.exists(manifest) && (parse_julia_version(readLines(manifest)[3]) == julia_version())
manifest_cached <- file.exists(manifest) &&
(julia_version() == parse_julia_version(readLines(manifest)[3]))
if (!dir.exists(userdir)) {
dir.create(userdir)
} else if (!manifest_cached) {
unlink(dir(userdir, full.names = TRUE), recursive = TRUE)
}
if (!manifest_cached) {
unlink(manifest)
}
pkgdir <- system.file("julia/", package = "jlmerclusterperm")
file.copy(from = pkgdir, to = userdir, recursive = TRUE)
JuliaConnectoR::juliaCall("cd", projdir)
JuliaConnectoR::juliaEval("using Pkg")
Expand Down
2 changes: 1 addition & 1 deletion R/calculate_pvalue.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down
2 changes: 1 addition & 1 deletion R/clusterpermute.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down
2 changes: 1 addition & 1 deletion R/compute_timewise_statistics.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down
4 changes: 2 additions & 2 deletions R/extract_clusters.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down Expand Up @@ -83,7 +83,7 @@ extract_empirical_clusters <- function(empirical_statistics, threshold, binned =
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down
2 changes: 1 addition & 1 deletion R/interop-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ JuliaConnectoR::stopJulia
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' }
#'
#' # Show current progress options
Expand Down
4 changes: 2 additions & 2 deletions R/jlmer.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down Expand Up @@ -57,7 +57,7 @@ to_jlmer <- function(formula, data, family = c("gaussian", "binomial"), jlmer_sp
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down
2 changes: 1 addition & 1 deletion R/julia_rng.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down
2 changes: 1 addition & 1 deletion R/permute.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down
2 changes: 1 addition & 1 deletion R/permute_timewise_statistics.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down
2 changes: 1 addition & 1 deletion R/threshold_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down
4 changes: 2 additions & 2 deletions R/tidy.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ generics::tidy
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down Expand Up @@ -99,7 +99,7 @@ tidy.jlmer_mod <- function(x, effects = c("var_model", "ran_pars", "fixed"), ...
#' \donttest{
#' \dontshow{
#' options("jlmerclusterperm.nthreads" = 2)
#' jlmerclusterperm_setup(verbose = FALSE)
#' jlmerclusterperm_setup(cache_dir = tempdir(), verbose = FALSE)
#' julia_progress(show = FALSE)
#' }
#'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ following as you see fit.
To cite jlmerclusterperm:

- Choe, J. (2023). jlmerclusterperm: Cluster-Based Permutation Analysis
for Densely Sampled Time Data. R package version 1.1.1.
for Densely Sampled Time Data. R package version 1.1.2.
<https://cran.r-project.org/package=jlmerclusterperm>.

To cite the cluster-based permutation test:
Expand Down
4 changes: 4 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Fixes for CRAN:

* Write cache to `tempdir()` for the purposes of running examples and tests.

## R CMD check results

0 errors | 0 warnings | 0 notes
2 changes: 1 addition & 1 deletion docs/404.html

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

2 changes: 1 addition & 1 deletion docs/CODE_OF_CONDUCT.html

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

2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.html

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

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

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

2 changes: 1 addition & 1 deletion docs/LICENSE.html

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

6 changes: 3 additions & 3 deletions docs/articles/Garrison-et-al-2020.html

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

8 changes: 4 additions & 4 deletions docs/articles/Geller-et-al-2020.html

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

Loading

0 comments on commit 03ca7ca

Please sign in to comment.