Skip to content

Commit

Permalink
Merge pull request #257 from grunwaldlab/fix-cran-bug-256
Browse files Browse the repository at this point in the history
Fix cran bug 256
  • Loading branch information
zkamvar authored Mar 25, 2023
2 parents 94c745a + fb00be0 commit ee9c908
Show file tree
Hide file tree
Showing 24 changed files with 244 additions and 226 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ vignettes/poppr_manual.Rmd
^pkgdown$
^\.github$
^docs$
^CRAN-SUBMISSION$
98 changes: 35 additions & 63 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master
branches: [main, master]
release:
types: [published]
schedule:
- cron: '0 4 * * 2'

name: R-CMD-check

Expand All @@ -22,70 +22,42 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
TINYTEX_INSTALLER: TinyTex

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-tinytex@v1
- name: Install LaTeX packages
run: |
tlmgr install colortbl
tlmgr install mathtools
tlmgr install preprint
tlmgr install natbib
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v2
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-tinytex@v2
# - name: Install LaTeX packages
# run: |
# tlmgr install colortbl
# tlmgr install mathtools
# tlmgr install preprint
# tlmgr install natbib

- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
extra-packages: any::rcmdcheck, local::.
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
50 changes: 50 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, local::.
needs: check

- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 2.9.4
Date: 2023-03-23 00:53:20 UTC
SHA: b43ac8e7096d534fab19e3a7834a42215b6e9081
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: poppr
Type: Package
Title: Genetic Analysis of Populations with Mixed Reproduction
Version: 2.9.3
Version: 2.9.4
Authors@R: c(person(c("Zhian", "N."), "Kamvar", role = c("cre", "aut"),
email = "zkamvar@gmail.com", comment = c(ORCID = "0000-0003-1458-7108")),
person(c("Javier", "F."), "Tabima", role = "aut",
Expand Down Expand Up @@ -33,7 +33,7 @@ Description: Population genetic analyses for hierarchical analysis of partially
clonal populations built upon the architecture of the 'adegenet' package.
Originally described in Kamvar, Tabima, and Grünwald (2014)
<doi:10.7717/peerj.281> with version 2.0 described in Kamvar, Brooks, and
Grünwald (2015) <doi:10.3389/fgene.2015.00208>.
Grünwald (2015) <doi:10.3389/fgene.2015.00208>.
MailingList: https://groups.google.com/d/forum/poppr
BugReports: https://github.com/grunwaldlab/poppr/issues/
Depends:
Expand Down Expand Up @@ -63,8 +63,8 @@ Suggests:
knitr,
rmarkdown,
poweRlaw,
cowplot,
RClone
cowplot
Config/Needs/check: dbailleul/RClone
License: GPL-2 | GPL-3
VignetteBuilder: knitr
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
16 changes: 16 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
poppr 2.9.4
===========

CRAN MAINTENANCE
----------------

* a function declaration was added for `SEXP omp_test()`
* failing tests were fixed.
* code where object classes were compared with `==` was fixed to use `inherits()`

DEPENDENCIES
------------

* {RClone} has been removed as a suggested package as it was archived on CRAN
some time ago.

poppr 2.9.3
===========

Expand Down
3 changes: 2 additions & 1 deletion R/bootstraping.R
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ diversity_boot <- function(tab, n, n.boot = 1L, n.rare = NULL, H = TRUE,
#' one clear method for calculating confidence intervals. A suggestion for
#' correction in Shannon's index is to center the CI around the observed
#' statistic (Marcon, 2012), but there are theoretical limitations to this.
#' For details, see <http://stats.stackexchange.com/q/156235/49413>.
#' For details, see <https://stats.stackexchange.com/q/156235/49413>.
#' }
#'
#' \subsection{User-defined functions}{
Expand All @@ -604,6 +604,7 @@ diversity_boot <- function(tab, n, n.boot = 1L, n.rare = NULL, H = TRUE,
#' vegan::rarefy(t(as.matrix(x)), 10)`).
#' }
#' @export
#' @md
#' @seealso [diversity_boot()] [diversity_stats()]
#' [poppr()] [boot::boot()] [boot::norm.ci()]
#' [boot::boot.ci()]
Expand Down
4 changes: 2 additions & 2 deletions R/data_subset.r
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ popsub <- function(gid, sublist="ALL", exclude=NULL, blacklist=NULL, mat=NULL, d
if (!is.null(exclude)){

# If both the sublist and exclude are numeric or character.
if (is.numeric(sublist) & is.numeric(exclude) | class(sublist) == class(exclude)){
if (is.numeric(sublist) && is.numeric(exclude) || identical(class(sublist), class(exclude))){
sublist <- sublist[!sublist %in% exclude]
} else if (is.numeric(sublist) & class(exclude) == "character"){
} else if (is.numeric(sublist) && inherits(exclude, "character")){
# if the sublist is numeric and exclude is a character. eg s=1:10, b="USA"
sublist <- sublist[sublist %in% which(!popnames %in% exclude)]
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/distances.r
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ diss.dist <- function(x, percent=FALSE, mat=FALSE){
#' Prevosti A. (1974) La distancia genetica entre poblaciones. Miscellanea
#' Alcobe, 68, 109-118.
#'
#' Prevosti A., Oca\~na J. and Alonso G. (1975) Distances
#' Prevosti A., Ocana J. and Alonso G. (1975) Distances
#' between populations of Drosophila subobscura, based on chromosome
#' arrangements frequencies. Theoretical and Applied Genetics, 45, 231-241.
#'
Expand Down
4 changes: 2 additions & 2 deletions R/internal.r
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ sub_index <- function(pop, sublist="ALL", exclude=NULL){
# Treating anything present in exclude.
if (!is.null(exclude)){
# If both the sublist and exclude are numeric or character.
if (is.numeric(sublist) & is.numeric(exclude) | class(sublist) == class(exclude)){
if (is.numeric(sublist) && is.numeric(exclude) || identical(class(sublist), class(exclude))) {
sublist <- sublist[!sublist %in% exclude]
} else if (is.numeric(sublist) & class(exclude) == "character"){
} else if (is.numeric(sublist) && inherits(exclude, "character")){
# if the sublist is numeric and exclude is a character. eg s=1:10, b="USA"
sublist <- sublist[sublist %in% which(!popNames(pop) %in% exclude)]
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/poppr.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
#'
#' Examples of analyses are available in a primer written by Niklaus J.
#' Grünwald, Zhian N. Kamvar, and Sydney E. Everhart at
#' <http://grunwaldlab.github.io/Population_Genetics_in_R/>.}
#' <https://grunwaldlab.github.io/Population_Genetics_in_R/>.}
#'
#' \subsection{Getting help}{ If you have a specific question or issue with
#' \pkg{poppr}, feel free to contribute to the google group at
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Poppr version 2 <img src="man/figures/small_logo.png" align="right" height="98"/>

<!-- badges: start -->
[![R-CMD-check](https://github.com/grunwaldlab/poppr/workflows/R-CMD-check/badge.svg)](https://github.com/grunwaldlab/poppr/actions)
[![R-CMD-check](https://github.com/grunwaldlab/poppr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/grunwaldlab/poppr/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

## What is *poppr*?
Expand Down Expand Up @@ -98,7 +98,7 @@ New features are occasionally added to {poppr}, but it can take time for it to
get to CRAN. If you know that you want the latest version of {poppr}, (which
will contain bug fixes and new features to be included in future releases), then
you can use the custom R-Universe repository, which is updated hourly:
<https://zkamvar.r-universe.dev/ui#builds>
<https://zkamvar.r-universe.dev/builds>

To install poppr from the R-Universe, you can use the following code:

Expand Down
24 changes: 3 additions & 21 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
# Poppr version 2.9.3
# Poppr version 2.9.4

This update rearranges the C files to declare all non-R headers before R headers to address the openmp failures in clang13 as pointed out by Prof. Ripley.

## Test environments

* local macOS install, R 4.1.1
* local ubuntu 20.04 install, R 4.1.1, R devel
* windows R Under development (unstable)

## R CMD check results

Ubuntu Linux: OK
macOS: OK
Windows: OK


## Downstream dependencies

- popprxl: OK
- vcfR: OK
- adegenet: OK
This fixes broken tests, provides a declaration for an exported C function, and fixes object class comparison to use identical()
This also removes RClone from Suggests. There is no user-facing code that contains RClone and it is an archived package on CRAN.

8 changes: 4 additions & 4 deletions inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ umlaut <- iconv("\x9f", from = "MAC", to = "UTF-8") # paste0("u", "\u0308")
header <- paste("To cite poppr in publications or presentations, please specify poppr version", meta$Version, "and with the following citation:")
citHeader(header)

citEntry(entry = 'article',
bibentry(bibtype = 'article',
title = "\\textit{Poppr}: an {R} package for genetic analysis of populations with clonal, partially clonal, and/or sexual reproduction.",
author = personList(as.person("Zhian N. Kamvar"),
author = c(as.person("Zhian N. Kamvar"),
as.person("Javier F. Tabima"),
as.person(paste0("Niklaus J. Gr", umlaut, "nwald"))
),
Expand All @@ -22,9 +22,9 @@ citEntry(entry = 'article',
textVersion = paste0("Kamvar ZN, Tabima JF, Grünwald NJ. (2014) Poppr: an R package for genetic analysis of populations with clonal, partially clonal, and/or sexual reproduction. PeerJ 2:e281. doi: 10.7717/peerj.281")
)

citEntry(entry = 'article',
bibentry(bibtype = 'article',
title = "{Novel R tools for analysis of genome-wide population genetic data with emphasis on clonality}",
author = personList(as.person("Zhian N. Kamvar"),
author = c(as.person("Zhian N. Kamvar"),
as.person("Jonah C. Brooks"),
as.person(paste0("Niklaus J. Gr", umlaut, "nwald"))
),
Expand Down
4 changes: 2 additions & 2 deletions man/bruvo.dist.Rd

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

6 changes: 4 additions & 2 deletions man/diversity_boot.Rd

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

Loading

0 comments on commit ee9c908

Please sign in to comment.