From fbc3a245b2655d1d6ed4f0485c71b1d6eef4f65d Mon Sep 17 00:00:00 2001
From: kauedesousa
Date: Tue, 28 Nov 2023 11:54:20 +0100
Subject: [PATCH] v1.1
---
DESCRIPTION | 4 +-
NEWS.md | 7 +++
R/AAA-getDataCM.R | 5 --
R/getProjectProgress.R | 1 -
R/getProjectsCM.R | 3 --
R/internal_functions.R | 3 --
R/randomize.R | 48 +++++++++++++++++---
README.md | 2 +-
codemeta.json | 6 +--
docs/404.html | 2 +-
docs/CODE_OF_CONDUCT.html | 2 +-
docs/CONTRIBUTING.html | 2 +-
docs/LICENSE-text.html | 2 +-
docs/articles/Overview.html | 18 ++++----
docs/articles/index.html | 2 +-
docs/authors.html | 2 +-
docs/index.html | 6 +--
docs/news/index.html | 11 ++++-
docs/pkgdown.yml | 2 +-
docs/reference/ClimMobTools.html | 6 +--
docs/reference/getDataCM.html | 2 +-
docs/reference/getProjectProgress.html | 2 +-
docs/reference/getProjectsCM.html | 2 +-
docs/reference/getTraitList.html | 2 +-
docs/reference/index.html | 2 +-
docs/reference/randomize.html | 63 +++++++++++++++++++-------
docs/reference/rankTricot.html | 2 +-
docs/reference/rmGeoIdentity.html | 2 +-
man/ClimMobTools.Rd | 2 +-
man/randomize.Rd | 33 +++++++++++++-
tests/diagnostic-randomize.R | 37 +++++++++++++++
vignettes/Overview.Rmd | 2 +-
32 files changed, 210 insertions(+), 75 deletions(-)
create mode 100644 tests/diagnostic-randomize.R
diff --git a/DESCRIPTION b/DESCRIPTION
index bcff510..52572f5 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Package: ClimMobTools
Type: Package
Title: API Client for the 'ClimMob' Platform
-Version: 1.0
+Version: 1.1
Authors@R: c(person("Kauê", "de Sousa",
email = "desousa.kaue@gmail.com",
role = c("aut", "cre"),
@@ -13,7 +13,7 @@ URL: https://agrdatasci.github.io/ClimMobTools/
BugReports: https://github.com/agrdatasci/ClimMobTools/issues
Description: API client for 'ClimMob', an open source software for decentralized
large-N trials with the 'tricot' approach .
- Developed by van Etten et al. (2016) , it turns the
+ Developed by Quiros et al. (2023) , it turns the
research paradigm on its head; instead of a few researchers designing complicated
trials to compare several technologies in search of the best solutions for the
target environment, it enables many participants to carry out reasonably simple
diff --git a/NEWS.md b/NEWS.md
index 6dbb09f..4b386c7 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,10 @@
+ClimMobTools 1.1 (2023-11-28)
+=========================
+
+### BUG FIXES
+
+* Fix an issue in `.smart.round()` to handle `NA` in the `randomize()` function
+
ClimMobTools 1.0 (2023-11-10)
=========================
diff --git a/R/AAA-getDataCM.R b/R/AAA-getDataCM.R
index f63a3fb..a1e755f 100644
--- a/R/AAA-getDataCM.R
+++ b/R/AAA-getDataCM.R
@@ -96,8 +96,3 @@ getDataCM <- function(key,
return(cmdata)
}
-
-
-
-
-
diff --git a/R/getProjectProgress.R b/R/getProjectProgress.R
index da34f4c..b172c80 100644
--- a/R/getProjectProgress.R
+++ b/R/getProjectProgress.R
@@ -120,4 +120,3 @@ getProjectProgress <- function(key, project, userowner, server = "climmob3"){
return(r)
}
-
diff --git a/R/getProjectsCM.R b/R/getProjectsCM.R
index f5a224a..8918fd3 100644
--- a/R/getProjectsCM.R
+++ b/R/getProjectsCM.R
@@ -120,6 +120,3 @@ getProjectsCM <- function(key, server = "climmob3", ...){
return(dat)
}
-
-
-
diff --git a/R/internal_functions.R b/R/internal_functions.R
index a8f0aa4..f702d60 100644
--- a/R/internal_functions.R
+++ b/R/internal_functions.R
@@ -234,6 +234,3 @@
return(ranks)
}
-
-
-
diff --git a/R/randomize.R b/R/randomize.R
index cda8ce8..f0f25c6 100644
--- a/R/randomize.R
+++ b/R/randomize.R
@@ -37,7 +37,38 @@
#' npackages = npackages,
#' itemnames = itemnames,
#' availability = availability)
-#'
+#'
+#' @examplesIf interactive()
+#' # run diagnostics to certify that randomization is balanced
+#' # the number of interactions should have the lower sd as possible
+#' # this verification may not work well when technologies are
+#' # tested in different proportions
+#' design = randomize(ncomp = ncomp,
+#' npackages = npackages,
+#' itemnames = itemnames)
+#'
+#' design$best = "A"
+#'
+#' design$worst = "C"
+#'
+#' # number of times each item is tested in the
+#' # trial design
+#' ntest = table(unlist(design[,c(1:3)]))
+#'
+#' ntest
+#'
+#' # put into the PlackettLuce structure to check
+#' # number of interactions between items
+#' r = gosset::rank_tricot(design, c(1:3), c(4:5))
+#'
+#' bn = gosset::set_binomialfreq(r)
+#'
+#' bn$interactions = bn$win1 + bn$win2
+#'
+#' bn = bn[,c(1,2,5)]
+#'
+#' bn
+#'
#' @aliases randomise
#' @importFrom Matrix Diagonal
#' @importFrom methods as
@@ -503,13 +534,16 @@ makeAllocationsMatrix <- function(allocations){
return(t(out))
}
-# Rounding values to closest integer while retaining the same sum
-# From https://stackoverflow.com/questions/32544646/round-vector-of-numerics-to-integer-while-preserving-their-sum
+#' Rounding values to closest integer while retaining the same sum
+#' https://stackoverflow.com/questions/32544646/round-vector-of-numerics-to-integer-while-preserving-their-sum
+#' @examples
+#' .smart.round(c(NA, 3.5, 7.8, 9, 10.4))
#' @noRd
-.smart.round <- function(x) {
- y <- floor(x)
- indices <- utils::tail(order(x-y), round(sum(x)) - sum(y))
- y[indices] <- y[indices] + 1
+.smart.round = function(x) {
+ x[is.na(x)] = 0
+ y = floor(x)
+ indices = utils::tail(order(x - y), round(sum(x)) - sum(y))
+ y[indices] = y[indices] + 1
y
}
diff --git a/README.md b/README.md
index 330683b..b0d2897 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ ClimMobTools
## Overview
-**ClimMobTools** the API Client for the 'ClimMob' platform in R. [ClimMob](https://climmob.net/) is an open source software for decentralized large-N trials with the 'tricot' approach. Developed by [van Etten et al. (2019)](https://doi.org/10.1017/S0014479716000739) 'tricot' turns the research paradigm on its head; instead of a few researchers designing complicated trials to compare several technologies in search of the best solutions, it enables many participants to carry out reasonably simple experiments that taken together can offer even more information.
+**ClimMobTools** the API Client for the 'ClimMob' platform in R. [ClimMob](https://climmob.net/) is an open source software for decentralized large-N trials with the 'tricot' approach. Developed by [Quiros et al. (2023)](http://dx.doi.org/10.2139/ssrn.4463406) 'tricot' turns the research paradigm on its head; instead of a few researchers designing complicated trials to compare several technologies in search of the best solutions, it enables many participants to carry out reasonably simple experiments that taken together can offer even more information.
## Package website
diff --git a/codemeta.json b/codemeta.json
index 70506d2..bd362e2 100644
--- a/codemeta.json
+++ b/codemeta.json
@@ -2,12 +2,12 @@
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"identifier": "ClimMobTools",
- "description": "API client for 'ClimMob', an open source software for decentralized large-N trials with the 'tricot' approach . Developed by van Etten et al. (2016) , it turns the research paradigm on its head; instead of a few researchers designing complicated trials to compare several technologies in search of the best solutions for the target environment, it enables many participants to carry out reasonably simple experiments that taken together can offer even more information. 'ClimMobTools' enables project managers to deep explore and analyse their 'ClimMob' data in R.",
+ "description": "API client for 'ClimMob', an open source software for decentralized large-N trials with the 'tricot' approach . Developed by Quiros et al. (2023) , it turns the research paradigm on its head; instead of a few researchers designing complicated trials to compare several technologies in search of the best solutions for the target environment, it enables many participants to carry out reasonably simple experiments that taken together can offer even more information. 'ClimMobTools' enables project managers to deep explore and analyse their 'ClimMob' data in R.",
"name": "ClimMobTools: API Client for the 'ClimMob' Platform",
"codeRepository": "https://agrdatasci.github.io/ClimMobTools/",
"issueTracker": "https://github.com/agrdatasci/ClimMobTools/issues",
"license": "https://spdx.org/licenses/MIT",
- "version": "1.0",
+ "version": "1.1",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
@@ -232,7 +232,7 @@
},
"SystemRequirements": null
},
- "fileSize": "1248.669KB",
+ "fileSize": "1250.405KB",
"citation": [
{
"@type": "ScholarlyArticle",
diff --git a/docs/404.html b/docs/404.html
index df50c42..90508ae 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -39,7 +39,7 @@
ClimMobTools
- 1.0
+ 1.1
diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html
index 089567b..eefd673 100644
--- a/docs/CODE_OF_CONDUCT.html
+++ b/docs/CODE_OF_CONDUCT.html
@@ -17,7 +17,7 @@
ClimMobTools
- 1.0
+ 1.1
diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html
index ecbacd0..a8c2bee 100644
--- a/docs/CONTRIBUTING.html
+++ b/docs/CONTRIBUTING.html
@@ -17,7 +17,7 @@
ClimMobTools
- 1.0
+ 1.1
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html
index 67edb31..f3732ef 100644
--- a/docs/LICENSE-text.html
+++ b/docs/LICENSE-text.html
@@ -17,7 +17,7 @@
ClimMobTools
- 1.0
+ 1.1
diff --git a/docs/articles/Overview.html b/docs/articles/Overview.html
index 670b3b9..0b1102a 100644
--- a/docs/articles/Overview.html
+++ b/docs/articles/Overview.html
@@ -40,7 +40,7 @@
ClimMobTools
- 1.0
+ 1.1
@@ -116,14 +116,14 @@
Usage
diff --git a/docs/articles/index.html b/docs/articles/index.html
index 3b79d7e..e8a8402 100644
--- a/docs/articles/index.html
+++ b/docs/articles/index.html
@@ -17,7 +17,7 @@
ClimMobTools
- 1.0
+ 1.1
diff --git a/docs/authors.html b/docs/authors.html
index 3d71fa6..2f88d6d 100644
--- a/docs/authors.html
+++ b/docs/authors.html
@@ -17,7 +17,7 @@
ClimMobTools
- 1.0
+ 1.1
diff --git a/docs/index.html b/docs/index.html
index 452cef2..1f6ebb3 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -20,7 +20,7 @@
ClimMobTools
- 1.0
+ 1.1
@@ -105,7 +105,7 @@