Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sdray/ade4
Browse files Browse the repository at this point in the history
  • Loading branch information
sdray committed Jul 12, 2024
2 parents 15a6bcf + 5d566ba commit b424327
Show file tree
Hide file tree
Showing 29 changed files with 248 additions and 262 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

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

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

Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:

- uses: r-lib/actions/check-r-package@v2
with:
args: 'c("--no-manual", "--as-cran", "--run-dontrun")'
args: 'c("--no-manual", "--as-cran")'
error-on: '"error"'
check-dir: '"check"'

56 changes: 56 additions & 0 deletions .github/workflows/build-bin-macOS-M1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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: build-macOS-M1

jobs:
build-bin-macOS-M1:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-14, r: 'release'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

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

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
pak-version: devel
extra-packages: any::rcmdcheck, any::XML
needs: check
# See https://github.com/r-lib/actions/issues/559 for the XML issue

- name: Build
run: |
install.packages("pkgbuild")
pkgbuild::build(".", binary = TRUE)
shell: Rscript {0}

- uses: actions/upload-artifact@v4
with:
name: binaries-for-mac-M1
path: /Users/runner/work/ade4/ade4_*.tgz

4 changes: 2 additions & 2 deletions .github/workflows/build-bin-macOS-x64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

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

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

Expand All @@ -49,7 +49,7 @@ jobs:
pkgbuild::build(".", binary = TRUE)
shell: Rscript {0}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: binaries-for-mac-x64
path: /Users/runner/work/ade4/ade4_*.tgz
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-bin-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

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

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

Expand All @@ -49,7 +49,7 @@ jobs:
pkgbuild::build(".", binary = TRUE)
shell: Rscript {0}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: binaries-for-windows
path: D:/a/ade4/ade4*.zip
2 changes: 1 addition & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/revdepcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
workflow_dispatch:
inputs:
which:
type: choice
description: Which dependents to check
options:
- strong
- most

name: Reverse dependency check

jobs:
revdep_check:
name: Reverse check ${{ inputs.which }} dependents
uses: r-devel/recheck/.github/workflows/recheck.yml@v1
with:
which: ${{ inputs.which }}
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ VignetteBuilder:
knitr
Description: Tools for multivariate data analysis. Several methods are provided for the analysis (i.e., ordination) of one-table (e.g., principal component analysis, correspondence analysis), two-table (e.g., coinertia analysis, redundancy analysis), three-table (e.g., RLQ analysis) and K-table (e.g., STATIS, multiple coinertia analysis). The philosophy of the package is described in Dray and Dufour (2007) <doi:10.18637/jss.v022.i04>.
License: GPL (>= 2)
URL: http://pbil.univ-lyon1.fr/ADE-4/
BugReports: https://github.com/sdray/ade4/issues
URL: https://adeverse.github.io/ade4/, http://pbil.univ-lyon1.fr/ADE-4/
BugReports: https://github.com/adeverse/ade4/issues
Encoding: UTF-8
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export("originality")
export("haar2level", "mld", "orthobasis.circ", "orthobasis.haar", "orthobasis.line", "orthobasis.mat", "orthobasis.neig", "is.orthobasis")

## ******* spatial *******
export("area2link", "area2poly", "area.plot", "dist.neig", "gridrowcol", "multispati.randtest", "mstree", "multispati.rtest", "nb2neig", "neig", "neig2mat", "neig2nb", "poly2area", "scores.neig")
export("area2link", "area2poly", "area.plot", "dist.neig", "gridrowcol", "mstree", "nb2neig", "neig", "neig2mat", "neig2nb", "poly2area", "scores.neig")

## ******* misc *********
export("bwca.dpcoa")
Expand Down Expand Up @@ -276,6 +276,8 @@ export("testertracenubisCpp")
## "plot.multispati"
## "print.multispati"
## "plot.multispati"
## "multispati.randtest"
## "multispati.rtest"

## ******* internal utilities *******

Expand Down
78 changes: 78 additions & 0 deletions R/ade4-deprecated.R
Original file line number Diff line number Diff line change
Expand Up @@ -1199,3 +1199,81 @@
s.match(x$li, x$ls, xax = xax, yax = yax, sub = "Scores and lag scores", csub = 2, clabel = 0.75)

}

"multispati.randtest" <- function (dudi, listw, nrepet = 999, ...) {

.Deprecated(new="multispati.randtest", package="ade4",
msg="The 'multispati.randtest' function is now deprecated in 'ade4' and will soon be available in the 'adespatial' package.")

if(!inherits(dudi,"dudi")) stop ("object of class 'dudi' expected")
if(!inherits(listw,"listw")) stop ("object of class 'listw' expected")
if(listw$style!="W") stop ("object of class 'listw' with style 'W' expected")

"testmultispati"<- function(nrepet, nr, nc, tab, mat, lw, cw) {
.C("testmultispati",
as.integer(nrepet),
as.integer(nr),
as.integer(nc),
as.double(as.matrix(tab)),
as.double(mat),
as.double(lw),
as.double(cw),
inersim=double(nrepet+1),
PACKAGE="ade4")$inersim
}

tab<- dudi$tab
nr<-nrow(tab)
nc<-ncol(tab)
mat<-spdep::listw2mat(listw)
lw<- dudi$lw
cw<- dudi$cw
if (!(identical(all.equal(lw,rep(1/nrow(tab), nrow(tab))),TRUE))) {
stop ("Not implemented for non-uniform weights")
}
inersim<- testmultispati(nrepet, nr, nc, tab, mat, lw, cw)
inertot<- sum(dudi$eig)
inersim<- inersim/inertot
obs <- inersim[1]
w <- as.randtest(sim = inersim[-1], obs = obs, call = match.call(), ...)
return(w)
}

"multispati.rtest" <- function (dudi, listw, nrepet = 99, ...) {

.Deprecated(new="multispati.rtest", package="ade4",
msg="The 'multispati.rtest' function is now deprecated in 'ade4' and will soon be available in the 'adespatial' package.")

if(!inherits(listw,"listw")) stop ("object of class 'listw' expected")
if(listw$style!="W") stop ("object of class 'listw' with style 'W' expected")
if (!(identical(all.equal(dudi$lw,rep(1/nrow(dudi$tab), nrow(dudi$tab))),TRUE))) {
stop ("Not implemented for non-uniform weights")
}

n <- length(listw$weights)
fun.lag <- function (x) spdep::lag.listw(listw,x,TRUE)
fun <- function (permuter = TRUE) {
if (permuter) {
permutation <- sample(n)
y <- dudi$tab[permutation,]
yw <- dudi$lw[permutation]
} else {
y <-dudi$tab
yw <- dudi$lw
}
y <- as.matrix(y)
ymoy <- apply(y, 2, fun.lag)
ymoy <- ymoy*yw
y <- y*ymoy
indexmoran <- sum(apply(y,2,sum)*dudi$cw)
return(indexmoran)
}
inertot <- sum(dudi$eig)
obs <- fun (permuter = FALSE)/inertot
if (nrepet == 0) return(obs)
perm <- unlist(lapply(1:nrepet, fun))/inertot
w <- as.randtest(obs = obs, sim = perm, call = match.call(), ...)
return(w)
}


2 changes: 1 addition & 1 deletion R/loocv.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ loocv.between <- function(x, nax = 0, progress = FALSE, parallel = FALSE, ...)
## The original analysis can be any dudi, so wee need to start from dudiCall$call:
jcall1 <- dudiCall$call
## Change the df argument to discard row #ind1:
jcall1[[2]] <- data.frame(eval.parent(jcall1[[2]]))[-ind1, , drop = FALSE]
jcall1[[2]] <- data.frame(eval.parent(jcall1[[2]], n = 2))[-ind1, , drop = FALSE]
## Check that the scannf argument is set to FALSE:
if (any(names(jcall1) == "scannf")) jcall1[[which(names(jcall1) == "scannf")]] <- FALSE
else {
Expand Down
39 changes: 0 additions & 39 deletions R/multispati.randtest.R

This file was deleted.

38 changes: 0 additions & 38 deletions R/multispati.rtest.R

This file was deleted.

Loading

0 comments on commit b424327

Please sign in to comment.