From a7aa8eafef7fc10110d450f4c978d6ff893a9fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lie=20Siberchicot?= Date: Mon, 30 Oct 2023 16:51:36 +0100 Subject: [PATCH 1/5] Update README.md: correct title --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 16ab398f..7bac4fe9 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ -# pkgdown +# [ade4](http://pbil.univ-lyon1.fr/ADE-4/) [![CRAN_Release_Badge](http://www.r-pkg.org/badges/version-ago/ade4)](http://cran.r-project.org/package=ade4) [![CRAN Downloads](https://cranlogs.r-pkg.org/badges/ade4)](https://cran.r-project.org/package=ade4) [![R-CMD-check](https://github.com/sdray/ade4/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/sdray/ade4/actions/workflows/R-CMD-check.yaml) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) -# [ade4](http://pbil.univ-lyon1.fr/ADE-4/) Analysis of Ecological Data: Exploratory and Euclidean Methods in Environmental Sciences Installing *ade4* From 6ccb22a14f1036df4a2f0dea5ddfdbf03dd1c1d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Dray?= Date: Mon, 6 Nov 2023 15:18:51 +0100 Subject: [PATCH 2/5] Correct the management of univariate cases (vector or matrix/data.frame with only one column) --- R/scalewt.R | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/R/scalewt.R b/R/scalewt.R index 27ff8dcc..1b6cb889 100644 --- a/R/scalewt.R +++ b/R/scalewt.R @@ -66,7 +66,7 @@ meanfacwt <- function(df, fac = NULL, wt = rep(1/nrow(df), nrow(df)), drop = FAL fac <- as.factor(fac) if(drop) fac <- factor(fac) - res <- t(sapply(split(df,fac),colMeans)) + res <- do.call("rbind", lapply(split(df,fac),colMeans)) } } else { if(is.null(fac)) { ## no factor @@ -77,10 +77,7 @@ meanfacwt <- function(df, fac = NULL, wt = rep(1/nrow(df), nrow(df)), drop = FAL fac <- factor(fac) df.list <- split(df, fac) wt.list <- split(wt, fac) - if(ncol(df) > 1) - res <- t(sapply(1:nlevels(fac), function(x) apply(df.list[[x]], 2, stats::weighted.mean, w = wt.list[[x]]))) - else - res <- as.matrix(sapply(1:nlevels(fac), function(x) apply(df.list[[x]], 2, stats::weighted.mean, w = wt.list[[x]]))) + res <- do.call("rbind", lapply(1:nlevels(fac), function(x) apply(df.list[[x]], 2, stats::weighted.mean, w = wt.list[[x]]))) rownames(res) <- names(df.list) } } @@ -110,7 +107,6 @@ covfacwt <- function(df, fac = NULL, wt = rep(1/nrow(df), nrow(df)), drop = FALS -## attention works only with data.frame or matrix varfacwt <- function(df, fac = NULL, wt = rep(1 / nrow(df), nrow(df)), drop = FALSE) { df <- data.frame(df) nr <- nrow(df) @@ -123,7 +119,7 @@ varfacwt <- function(df, fac = NULL, wt = rep(1 / nrow(df), nrow(df)), drop = FA fac <- factor(fac) df.list <- split(df, fac) wt.list <- split(wt, fac) - res <- t(sapply(1:nlevels(fac), FUN = function(x) {apply(df.list[[x]], 2, varwt, wt = wt.list[[x]])})) + res <- do.call("rbind", lapply(1:nlevels(fac), function(x) apply(df.list[[x]], 2, varwt, w = wt.list[[x]]))) rownames(res) <- names(df.list) } return(res) From 10c58cc7722ac5bd01efa20f835a27cd43a948a7 Mon Sep 17 00:00:00 2001 From: Jean Thioulouse Date: Thu, 16 Nov 2023 16:36:52 +0100 Subject: [PATCH 3/5] Update loocv.R Changed the eval.parent call in the trt1 parallel function to get the modified data table --- R/loocv.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/loocv.R b/R/loocv.R index aa43d2b5..d350318c 100644 --- a/R/loocv.R +++ b/R/loocv.R @@ -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 { From 1a2ff4bb52d934faddf744c478a3b1e620b2099c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lie=20Siberchicot?= Date: Fri, 17 Nov 2023 09:46:06 +0100 Subject: [PATCH 4/5] Update R-CMD-check.yaml --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 2bb3206a..b17e7af0 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -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"' From afee24db780b14282c0d476b19a50d1de916e780 Mon Sep 17 00:00:00 2001 From: Jean Thioulouse Date: Fri, 17 Nov 2023 11:20:57 +0100 Subject: [PATCH 5/5] Update loocv.R