Skip to content

Commit 3cd265e

Browse files
committed
fix CRAN and GitHub Actions issues
1 parent 7e5d445 commit 3cd265e

24 files changed

+94
-30
lines changed

R/AIC_momentuHMM.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' @method AIC momentuHMM
77
#'
88
#' @param object A \code{momentuHMM} object.
9-
#' @param ... Optional additional \code{momentuHMM} objects, to compare AICs of the different models. These can be passed as a list using the \code{!!!} operator (see \code{\link[=quasiquotation]{rlang}} and example in \code{\link{AICweights}}).
9+
#' @param ... Optional additional \code{momentuHMM} objects, to compare AICs of the different models. These can be passed as a list using the \code{!!!} operator (see \code{\link[rlang]{splice-operator}} and example in \code{\link{AICweights}}).
1010
#' @param k Penalty per parameter. Default: 2 ; for classical AIC.
1111
#' @param n Optional sample size. If specified, the small sample correction AIC is used (i.e., \code{AICc = AIC + kp(p+1)/(n-p-1)} where p is the number of parameters).
1212
#'

R/AICweights.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
#' Calculate Akaike information criterion model weights
33
#'
4-
#' @param ... \code{\link{momentuHMM}}, \code{\link{HMMfits}}, or \code{\link{miHMM}} objects, to compare AIC weights of the different models. The first object must be a \code{\link{momentuHMM}}, \code{\link{HMMfits}}, or \code{\link{miHMM}} object, but additional model objects can be passed as a list using the \code{!!!} operator (see \code{\link[=quasiquotation]{rlang}}).
4+
#' @param ... \code{\link{momentuHMM}}, \code{\link{HMMfits}}, or \code{\link{miHMM}} objects, to compare AIC weights of the different models. The first object must be a \code{\link{momentuHMM}}, \code{\link{HMMfits}}, or \code{\link{miHMM}} object, but additional model objects can be passed as a list using the \code{!!!} operator (see \code{\link[rlang]{splice-operator}}).
55
#' @param k Penalty per parameter. Default: 2 ; for classical AIC.
66
#' @param n Optional sample size. If specified, the small sample correction AIC is used (i.e., \code{AICc = AIC + kp(p+1)/(n-p-1)} where p is the number of parameters).
77
#'

R/BIC_momentuHMM.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' @method BIC momentuHMM
77
#'
88
#' @param object A \code{momentuHMM} object.
9-
#' @param ... Optional additional \code{momentuHMM} objects, to compare BICs of the different models. These can be passed as a list using the \code{!!!} operator (see \code{\link[=quasiquotation]{rlang}} and example in \code{\link{BICweights}}).
9+
#' @param ... Optional additional \code{momentuHMM} objects, to compare BICs of the different models. These can be passed as a list using the \code{!!!} operator (see \code{\link[rlang]{splice-operator}} and example in \code{\link{BICweights}}).
1010
#' @param n Optional sample size. If not specified, the number of rows in the data of the \code{momentuHMM} object is used.
1111
#'
1212
#' @return The BIC of the model(s) provided. If several models are provided, the BICs are output

R/BICweights.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
#' Calculate Bayesian information criterion model weights
33
#'
4-
#' @param ... \code{\link{momentuHMM}}, \code{\link{HMMfits}}, or \code{\link{miHMM}} objects, to compare BIC weights of the different models. The first object must be a \code{\link{momentuHMM}}, \code{\link{HMMfits}}, or \code{\link{miHMM}} object, but additional model objects can be passed as a list using the \code{!!!} operator (see \code{\link[=quasiquotation]{rlang}}).
4+
#' @param ... \code{\link{momentuHMM}}, \code{\link{HMMfits}}, or \code{\link{miHMM}} objects, to compare BIC weights of the different models. The first object must be a \code{\link{momentuHMM}}, \code{\link{HMMfits}}, or \code{\link{miHMM}} object, but additional model objects can be passed as a list using the \code{!!!} operator (see \code{\link[rlang]{splice-operator}}).
55
#' @param n Optional sample size. If not specified, the number of rows in the data of the \code{momentuHMM} object is used.
66
#'
77
#' @return The BIC weights of the models. If multiple imputation objects are provided,

R/MIfitCTHMM.R

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#' and fit the specified HMM to each imputation of the data. The vast majority of \code{MIfitCTHMM} arguments are identical to the corresponding arguments from these functions.
1515
#'
1616
#' If \code{miData} is a \code{\link{crwData}} or \code{\link{crwHierData}} object, \code{nSims} determines both the number of realizations of the position process to draw
17-
#' (using \code{\link[crawl]{crwSimulator}} and \code{\link{crwPostIS}}) as well as the number of HMM fits.
17+
#' (using \code{\link[crawl]{crwSimulator}} and \code{\link[crawl]{crwPostIS}}) as well as the number of HMM fits.
1818
#'
1919
#' If \code{miData} is a \code{\link{crwSim}} (or \code{\link{crwHierSim}}) object or a list of \code{\link{momentuHMMData}} (or \code{\link{momentuHierHMMData}}) object(s), the specified HMM will simply be fitted to each of the \code{momentuHMMData} (or \code{momentuHierHMMData}) objects
2020
#' and all arguments related to \code{\link[crawl]{crwSimulator}}, \code{\link[crawl]{crwPostIS}}, or \code{\link{prepData}} are ignored.
@@ -232,7 +232,11 @@ MIfitCTHMM.default<-function(miData,nSims, ncores = 1, poolEstimates = TRUE, alp
232232
}
233233
oldDoPar <- doFuture::registerDoFuture()
234234
on.exit(with(oldDoPar, foreach::setDoPar(fun=fun, data=data, info=info)), add = TRUE)
235-
future::plan(future::multisession, workers = ncores)
235+
if (Sys.getenv("CI") == "true" && grepl("macOS", Sys.getenv("RUNNER_OS"))) {
236+
future::plan(future::sequential)
237+
} else {
238+
future::plan(future::multisession, workers = ncores)
239+
}
236240
# hack so that foreach %dorng% can find internal momentuHMM variables without using ::: (forbidden by CRAN)
237241
progBar <- progBar
238242
pkgs <- c("momentuHMM")
@@ -539,7 +543,11 @@ MIfitCTHMM.hierarchical<-function(miData,nSims, ncores = 1, poolEstimates = TRUE
539543
}
540544
oldDoPar <- doFuture::registerDoFuture()
541545
on.exit(with(oldDoPar, foreach::setDoPar(fun=fun, data=data, info=info)), add = TRUE)
542-
future::plan(future::multisession, workers = ncores)
546+
if (Sys.getenv("CI") == "true" && grepl("macOS", Sys.getenv("RUNNER_OS"))) {
547+
future::plan(future::sequential)
548+
} else {
549+
future::plan(future::multisession, workers = ncores)
550+
}
543551
# hack so that foreach %dorng% can find internal momentuHMM variables without using ::: (forbidden by CRAN)
544552
progBar <- progBar
545553
pkgs <- c("momentuHMM","data.tree")

R/MIfitHMM.R

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#' and fit the specified HMM to each imputation of the data. The vast majority of \code{MIfitHMM} arguments are identical to the corresponding arguments from these functions.
1414
#'
1515
#' If \code{miData} is a \code{\link{crwData}} or \code{\link{crwHierData}} object, \code{nSims} determines both the number of realizations of the position process to draw
16-
#' (using \code{\link[crawl]{crwSimulator}} and \code{\link{crwPostIS}}) as well as the number of HMM fits.
16+
#' (using \code{\link[crawl]{crwSimulator}} and \code{\link[crawl]{crwPostIS}}) as well as the number of HMM fits.
1717
#'
1818
#' If \code{miData} is a \code{\link{crwSim}} (or \code{\link{crwHierSim}}) object or a list of \code{\link{momentuHMMData}} (or \code{\link{momentuHierHMMData}}) object(s), the specified HMM will simply be fitted to each of the \code{momentuHMMData} (or \code{momentuHierHMMData}) objects
1919
#' and all arguments related to \code{\link[crawl]{crwSimulator}}, \code{\link[crawl]{crwPostIS}}, or \code{\link{prepData}} are ignored.
@@ -262,7 +262,11 @@ MIfitHMM.default<-function(miData,nSims, ncores = 1, poolEstimates = TRUE, alpha
262262
}
263263
oldDoPar <- doFuture::registerDoFuture()
264264
on.exit(with(oldDoPar, foreach::setDoPar(fun=fun, data=data, info=info)), add = TRUE)
265-
future::plan(future::multisession, workers = ncores)
265+
if (Sys.getenv("CI") == "true" && grepl("macOS", Sys.getenv("RUNNER_OS"))) {
266+
future::plan(future::sequential)
267+
} else {
268+
future::plan(future::multisession, workers = ncores)
269+
}
266270
# hack so that foreach %dorng% can find internal momentuHMM variables without using ::: (forbidden by CRAN)
267271
progBar <- progBar
268272
pkgs <- c("momentuHMM")
@@ -553,7 +557,11 @@ MIfitHMM.hierarchical<-function(miData,nSims, ncores = 1, poolEstimates = TRUE,
553557
}
554558
oldDoPar <- doFuture::registerDoFuture()
555559
on.exit(with(oldDoPar, foreach::setDoPar(fun=fun, data=data, info=info)), add = TRUE)
556-
future::plan(future::multisession, workers = ncores)
560+
if (Sys.getenv("CI") == "true" && grepl("macOS", Sys.getenv("RUNNER_OS"))) {
561+
future::plan(future::sequential)
562+
} else {
563+
future::plan(future::multisession, workers = ncores)
564+
}
557565
# hack so that foreach %dorng% can find internal momentuHMM variables without using ::: (forbidden by CRAN)
558566
progBar <- progBar
559567
pkgs <- c("momentuHMM","data.tree","TMB")

R/MIpool.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ MIpool<-function(im, alpha=0.95, ncores=1, covs=NULL, na.rm=FALSE){
7979
}
8080
oldDoPar <- doFuture::registerDoFuture()
8181
on.exit(with(oldDoPar, foreach::setDoPar(fun=fun, data=data, info=info)), add = TRUE)
82-
future::plan(future::multisession, workers = ncores)
82+
if (Sys.getenv("CI") == "true" && grepl("macOS", Sys.getenv("RUNNER_OS"))) {
83+
future::plan(future::sequential)
84+
} else {
85+
future::plan(future::multisession, workers = ncores)
86+
}
8387
# hack so that foreach %dorng% can find internal momentuHMM variables without using ::: (forbidden by CRAN)
8488
progBar <- progBar
8589
pkgs <- c("momentuHMM")
@@ -738,7 +742,11 @@ MIpool<-function(im, alpha=0.95, ncores=1, covs=NULL, na.rm=FALSE){
738742
call. = FALSE)
739743
} else {
740744
if(ncores>1){
741-
future::plan(future::multisession, workers = ncores)
745+
if (Sys.getenv("CI") == "true" && grepl("macOS", Sys.getenv("RUNNER_OS"))) {
746+
future::plan(future::sequential)
747+
} else {
748+
future::plan(future::multisession, workers = ncores)
749+
}
742750
} else {
743751
doParallel::registerDoParallel(cores=ncores)
744752
}

R/crawlWrap.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ crawlWrap<-function(obsData, timeStep=1, ncores = 1, retryFits = 0, retrySD = 1,
173173
}
174174
}
175175
oldDoPar <- doFuture::registerDoFuture()
176-
future::plan(future::multisession, workers = ncores)
176+
if (Sys.getenv("CI") == "true" && grepl("macOS", Sys.getenv("RUNNER_OS"))) {
177+
future::plan(future::sequential)
178+
} else {
179+
future::plan(future::multisession, workers = ncores)
180+
}
177181
on.exit(with(oldDoPar, foreach::setDoPar(fun=fun, data=data, info=info)), add = TRUE)
178182
} else {
179183
doParallel::registerDoParallel(cores=ncores)
@@ -230,7 +234,11 @@ crawlWrap<-function(obsData, timeStep=1, ncores = 1, retryFits = 0, retrySD = 1,
230234

231235
# Check crwFits and re-try based on retryFits
232236
if(ncores>1 & nbAnimals>1 & retryFits & retryParallel){
233-
future::plan(future::multisession, workers = ncores)
237+
if (Sys.getenv("CI") == "true" && grepl("macOS", Sys.getenv("RUNNER_OS"))) {
238+
future::plan(future::sequential)
239+
} else {
240+
future::plan(future::multisession, workers = ncores)
241+
}
234242
if(retryParallel) cat("Attempting to achieve convergence and valid variance estimates for each individual in parallel.\n Press 'esc' to force exit from 'crawlWrap'... \n",sep="")
235243
} else {
236244
doParallel::registerDoParallel(cores=1)

R/plotSat.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#' @param return If \code{TRUE}, the function returns a ggplot object (which can be edited and
2828
#' plotted manually). If \code{FALSE}, the function automatically plots the map (default).
2929
#' @param stateNames Optional character vector of length \code{max(states)} indicating state names. Ignored unless \code{states} is provided.
30-
#' @param projargs A character string of PROJ.4 projection arguments indicating the coordinate reference system for \code{data} and \code{location} coordinates (if not longitude and latitude). A \code{\link[=CRS-class]{CRS}} object is also permitted. If \code{projargs} is provided, the coordinates will be internally transformed to longitude and latitude for plotting.
30+
#' @param projargs A character string of PROJ.4 projection arguments indicating the coordinate reference system for \code{data} and \code{location} coordinates (if not longitude and latitude). A \code{\link[sp]{CRS-class}} object is also permitted. If \code{projargs} is provided, the coordinates will be internally transformed to longitude and latitude for plotting.
3131
#'
3232
#' @details If the plot displays the message "Sorry, we have no imagery here", try a
3333
#' lower level of zoom.

R/prepCTDS.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ prepCTDS.default <- function(data, Time.unit="auto", rast, directions=4, zero.id
129129
}
130130
oldDoPar <- doFuture::registerDoFuture()
131131
on.exit(with(oldDoPar, foreach::setDoPar(fun=fun, data=data, info=info)), add = TRUE)
132-
future::plan(future::multisession, workers = ncores)
132+
if (Sys.getenv("CI") == "true" && grepl("macOS", Sys.getenv("RUNNER_OS"))) {
133+
future::plan(future::sequential)
134+
} else {
135+
future::plan(future::multisession, workers = ncores)
136+
}
133137
# hack so that foreach %dorng% can find internal momentuHMM variables without using ::: (forbidden by CRAN)
134138
progBar <- progBar
135139
path2ctds <- path2ctds
@@ -314,7 +318,11 @@ prepCTDS.hierarchical <- function(data, Time.unit="auto", rast, directions=4, ze
314318
}
315319
oldDoPar <- doFuture::registerDoFuture()
316320
on.exit(with(oldDoPar, foreach::setDoPar(fun=fun, data=data, info=info)), add = TRUE)
317-
future::plan(future::multisession, workers = ncores)
321+
if (Sys.getenv("CI") == "true" && grepl("macOS", Sys.getenv("RUNNER_OS"))) {
322+
future::plan(future::sequential)
323+
} else {
324+
future::plan(future::multisession, workers = ncores)
325+
}
318326
# hack so that foreach %dorng% can find internal momentuHMM variables without using ::: (forbidden by CRAN)
319327
progBar <- progBar
320328
path2ctds <- path2ctds

0 commit comments

Comments
 (0)