Skip to content

Commit

Permalink
Merge pull request #29 from nicholasjclark/development
Browse files Browse the repository at this point in the history
Updates for v1.38 CRAN release
  • Loading branch information
nicholasjclark authored Mar 22, 2021
2 parents 9440e81 + 1be86fe commit dba1ec6
Show file tree
Hide file tree
Showing 27 changed files with 274 additions and 1,583 deletions.
10 changes: 6 additions & 4 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
^.*\.Rproj$
^\.Rproj\.user$
^README\.Rmd$
^README-.*\.png$
^docs$
^cran-comments.md$
^doc$
^Meta$
^CRAN-RELEASE
^cran-comments.md
^docs
^CRAN-RELEASE$
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ README-unnamed-chunk-6-1.png
README-unnamed-chunk-7-1.png
README-unnamed-chunk-8-1.png
README-unnamed-chunk-9-1.png
doc
Meta
2 changes: 2 additions & 0 deletions CRAN-RELEASE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This package was submitted to CRAN on 2021-03-18.
Once it is accepted, delete this file and tag the release (commit cb7d26c).
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: MRFcov
Type: Package
Title: Markov Random Fields with Additional Covariates
Version: 1.0.37
Date/Publication: 2019-11-04
Version: 1.0.38
Date/Publication: 2021-02-25
URL: https://github.com/nicholasjclark/MRFcov
Authors@R: c(
person("Nicholas J", "Clark", email = "[email protected]", role = c("aut", "cre")),
Expand Down Expand Up @@ -35,7 +35,7 @@ Imports: purrr,
MASS
License: GPL-3
Encoding: UTF-8
RoxygenNote: 6.1.1
RoxygenNote: 7.1.1
LazyData: true
Suggests: testthat,
knitr,
Expand Down
7 changes: 2 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# MRFcov 1.0.40
# MRFcov 1.0.38
* Improved nonparanormal mapping of predictions for discrete variables

# MRFcov 1.0.39
* Option to remove progress bar in multicore estimation, significantly speeding up analysis runs
* Improvement for the detection of infinite values in data and coordinates

# MRFcov 1.0.38
* Option to prep spatial splines separately to allow efficient out-of-sample cross-validation

# MRFcov 1.0.37
Expand Down
2 changes: 1 addition & 1 deletion R/Bird.parasites.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
#' @references Clark, N.J., Wells, K., Dimitrov, D. & Clegg, S.M. (2016)
#' Co-infections and environmental conditions drive the distributions of blood
#' parasites in wild birds. Journal of Animal Ecology, 85, 1461-1470.
#' @source \url{http://dx.doi.org/10.5061/dryad.pp6k4}
#' @source \doi{10.5061/dryad.pp6k4}
"Bird.parasites"
11 changes: 10 additions & 1 deletion R/MRFcov.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#'coefficients are estimated on the identity scale AFTER using a nonparanormal transformation.
#'See \code{vignette("Gaussian_Poisson_CRFs")} for details of interpretation
#'@param bootstrap Logical. Used by \code{\link{bootstrap_MRF}} to reduce memory usage
#'@param progress_bar Logical. Progress bar in pbapply is used if \code{TRUE}, but this slows estimation.
#'
#'@return A \code{list} containing:
#'\itemize{
Expand Down Expand Up @@ -120,7 +121,7 @@
#'
MRFcov <- function(data, symmetrise,
prep_covariates, n_nodes, n_cores, n_covariates,
family, bootstrap = FALSE) {
family, bootstrap = FALSE, progress_bar = FALSE) {

#### Specify default parameter values and initiate warnings ####
if(!(family %in% c('gaussian', 'poisson', 'binomial')))
Expand Down Expand Up @@ -364,6 +365,14 @@ MRFcov <- function(data, symmetrise,

#### If n_cores > 1, check for parallel loading before initiating parallel clusters ####
if(n_cores > 1){

# Progress bar significantly slows estimation, set to FALSE unless specified
if(progress_bar){
pbapply::pboptions(style = 1, char = "+", type = 'timer')
} else {
pbapply::pboptions(type="none")
}

#Initiate the n_cores parallel clusters
cl <- makePSOCKcluster(n_cores)
setDefaultCluster(cl)
Expand Down
11 changes: 10 additions & 1 deletion R/MRFcov_spatial.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#'@param prep_splines Logical. If spatial splines are already included in \code{data}, set to
#'\code{FALSE}. Default is \code{TRUE}
#'@param bootstrap Logical. Used by \code{\link{bootstrap_MRF}} to reduce memory usage
#'@param progress_bar Logical. Progress bar in pbapply is used if \code{TRUE}, but this slows estimation.
#'
#'@return A \code{list} of all elements contained in a returned \code{\link{MRFcov}} object, with
#'the inclusion of a \code{dataframe} called \code{mrf_data}. This contains all prepped covariates
Expand All @@ -86,7 +87,7 @@
#'@export
#'
MRFcov_spatial <- function(data, symmetrise, prep_covariates, n_nodes, n_cores, n_covariates,
family, coords, prep_splines = TRUE, bootstrap = FALSE) {
family, coords, prep_splines = TRUE, bootstrap = FALSE, progress_bar = FALSE) {

#### Specify default parameter values and initiate warnings ####
if(!(family %in% c('gaussian', 'poisson', 'binomial')))
Expand Down Expand Up @@ -381,6 +382,14 @@ MRFcov_spatial <- function(data, symmetrise, prep_covariates, n_nodes, n_cores,

#### If n_cores > 1, check for parallel loading before initiating parallel clusters ####
if(n_cores > 1){

# Progress bar significantly slows estimation, set to FALSE unless specified
if(progress_bar){
pbapply::pboptions(style = 1, char = "+", type = 'timer')
} else {
pbapply::pboptions(type="none")
}

#Initiate the n_cores parallel clusters
cl <- makePSOCKcluster(n_cores)
setDefaultCluster(cl)
Expand Down
12 changes: 11 additions & 1 deletion R/predict_MRF.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#'by cross-multiplication (\code{TRUE} by default; \code{FALSE} when used in other functions)
#'@param n_cores Positive integer stating the number of processing cores to split the job across.
#'Default is \code{1} (no parallelisation)
#'@param progress_bar Logical. Progress bar in pbapply is used if \code{TRUE}, but this slows estimation.
#'@return A \code{matrix} containing predictions for each observation in \code{data}. If
#'\code{family = "binomial"}, a second element containing binary
#'predictions for nodes is returned.
Expand Down Expand Up @@ -59,14 +60,23 @@
#'
#'@export
#'
predict_MRF <- function(data, MRF_mod, prep_covariates = TRUE, n_cores){
predict_MRF <- function(data, MRF_mod, prep_covariates = TRUE, n_cores,
progress_bar = FALSE){

if(missing(n_cores)){
n_cores <- 1
}

#### If n_cores > 1, check parallel library loading ####
if(n_cores > 1){

# Progress bar significantly slows estimation, set to FALSE unless specified
if(progress_bar){
pbapply::pboptions(style = 1, char = "+", type = 'timer')
} else {
pbapply::pboptions(type="none")
}

#Initiate the n_cores parallel clusters
cl <- makePSOCKcluster(n_cores)
setDefaultCluster(cl)
Expand Down
9 changes: 6 additions & 3 deletions R/predict_MRFnetworks.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#'networks from \code{\link{MRFcov_spatial}} objects)
#'@param n_cores Positive integer stating the number of processing cores to split the job across.
#'Default is \code{1} (no parallelisation)
#'@param progress_bar Logical. Progress bar in pbapply is used if \code{TRUE}, but this slows estimation.
#'
#'@return Either a \code{matrix} with \code{nrow = nrow(data)},
#'containing each species' predicted network metric at each observation in \code{data}, or
Expand Down Expand Up @@ -64,7 +65,7 @@
#'
predict_MRFnetworks = function(data, MRF_mod, cutoff, omit_zeros, metric,
cached_predictions = NULL, prep_covariates,
n_cores){
n_cores, progress_bar = FALSE){

if(missing(n_cores)){
n_cores <- 1
Expand Down Expand Up @@ -157,15 +158,17 @@ predict_MRFnetworks = function(data, MRF_mod, cutoff, omit_zeros, metric,
if(MRF_mod$mod_family == "binomial"){
if(is.null(cached_predictions)){
preds <- predict_MRF(pred.prepped.dat, MRF_mod_booted,
prep_covariates = FALSE, n_cores = n_cores)$Probability_predictions
prep_covariates = FALSE, n_cores = n_cores,
progress_bar = progress_bar)$Probability_predictions
} else {
preds <- cached_predictions$Probability_predictions
}

} else {
if(is.null(cached_predictions)){
preds <- predict_MRF(pred.prepped.dat, MRF_mod_booted,
prep_covariates = FALSE, n_cores = n_cores)
prep_covariates = FALSE, n_cores = n_cores,
progress_bar = progress_bar)
} else {
preds <- cached_predictions
}
Expand Down
21 changes: 17 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Patch updates for release v1.0.40
## Patch updates for release v1.0.38
This update contains improvments to the nonparanormal mapping of predictions for discrete variables

## Test environments
Expand All @@ -8,8 +8,21 @@ This update contains improvments to the nonparanormal mapping of predictions for
## R CMD check results
There were no ERRORs or WARNINGs.

The following NOTE appeared in the win-builder check:
* checking CRAN incoming feasibility ... NOTE
An ERROR appears in the win-builder check for r-devel-windows-ix86+x86_64, likely owing to failures on r-devel-windows-ix86+x86_64 due to missing dependencies that need compilation. A test using `rhub::check( platform="windows-x86_64-devel", env_vars=c(R_COMPILE_AND_INSTALL_PACKAGES = "always"))` passes the win-builder check

Previously three top level files were non-standard. These have been moved to .Rbuildignore and now are not flagged in R RMD checks

Previously the version of this update was not sufficient for CRAN requirements: Insufficient package version (submitted: 1.0.4, existing: 1.0.37). This has been changed (new version is 1.0.38)

A URL in the one of the vignettes previously did not have https. The CRAN note was
* Found the following (possibly) invalid URLs: URL: http://www.jmlr.org/papers/v10/liu09a.html (moved to https://www.jmlr.org/papers/v10/liu09a.html) From: inst/doc/Gaussian_Poisson_CRFs.html Status: 200

This has been changed to the suggested https format

Previously a DOI was not formatted according to CRAN requirements: Found the following URLs which should use \doi (with the DOI name only): File 'Bird.parasites.Rd': http://dx.doi.org/10.5061/dryad.pp6k4

This has been fixed


Maintainer: 'Nicholas J Clark <[email protected]>'

No action was taken, as this note apparently reminds CRAN maintainers to check that the submission actually comes from myself and not anybody else.
2 changes: 1 addition & 1 deletion docs/README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ MRF_mod$key_coefs$Plas
MRF_mod$key_coefs$Microfilaria
```

To work through more in-depth tutorials and examples, see the vignettes in the package and check out papers that have been published using the method
To work through more in-depth tutorials and examples, see the vignettes in the package and check out some of the papers that have been published using the method
```{r eval=FALSE}
vignette("Bird_Parasite_CRF")
vignette("Gaussian_Poisson_CRFs")
Expand Down
8 changes: 5 additions & 3 deletions man/Bird.parasites.Rd

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

15 changes: 13 additions & 2 deletions man/MRFcov.Rd

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

17 changes: 15 additions & 2 deletions man/MRFcov_spatial.Rd

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

16 changes: 13 additions & 3 deletions man/bootstrap_MRF.Rd

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

Loading

0 comments on commit dba1ec6

Please sign in to comment.