Skip to content

Commit c8c7ea4

Browse files
authored
Merge pull request #107 from ttscience/106-validate-minimization-randomization-with-unequal-allocation-ratios
Bugfix: unequal allocation
2 parents f570d20 + 951f8f3 commit c8c7ea4

File tree

14 files changed

+331
-29
lines changed

14 files changed

+331
-29
lines changed

.github/workflows/document.yaml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,30 @@ jobs:
2020
- name: Setup R
2121
uses: r-lib/actions/setup-r@v2
2222
with:
23+
r-version: '4.2.3'
2324
use-public-rspm: true
2425

25-
- name: Install dependencies
26-
uses: r-lib/actions/setup-r-dependencies@v2
27-
with:
28-
extra-packages: any::roxygen2
29-
needs: roxygen2
26+
- name: Install system dependencies for systemfonts
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y --no-install-recommends \
30+
pkg-config \
31+
libfontconfig1-dev \
32+
libfreetype6-dev \
33+
libharfbuzz-dev \
34+
libfribidi-dev
35+
36+
- uses: r-lib/actions/setup-renv@v2
37+
38+
- name: Install CI extras (roxygen2)
39+
run: |
40+
pkgs <- c("roxygen2")
41+
for (p in pkgs) {
42+
if (!requireNamespace(p, quietly = TRUE)) {
43+
install.packages(p, repos = "https://packagemanager.posit.co/cran/latest")
44+
}
45+
}
46+
shell: Rscript {0}
3047

3148
- name: Document
3249
run: roxygen2::roxygenise()

.github/workflows/lint.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@ jobs:
1818

1919
- uses: r-lib/actions/setup-r@v2
2020
with:
21+
r-version: '4.2.3'
2122
use-public-rspm: true
2223

23-
- uses: r-lib/actions/setup-r-dependencies@v2
24-
with:
25-
extra-packages: any::lintr, local::.
26-
needs: lint
24+
- uses: r-lib/actions/setup-renv@v2
25+
26+
- name: Install CI extras (lintr, cyclocomp)
27+
run: |
28+
pkgs <- c("lintr", "cyclocomp")
29+
for (p in pkgs) {
30+
if (!requireNamespace(p, quietly = TRUE)) {
31+
install.packages(p, repos = "https://packagemanager.posit.co/cran/latest")
32+
}
33+
}
34+
shell: Rscript {0}
2735

2836
- name: Lint
2937
run: lintr::lint_package()

.github/workflows/pkgdown.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,21 @@ jobs:
2626

2727
- uses: r-lib/actions/setup-r@v2
2828
with:
29+
r-version: '4.2.3'
2930
use-public-rspm: true
3031
install-pandoc: true
3132

32-
- uses: r-lib/actions/setup-r-dependencies@v2
33-
with:
34-
extra-packages: any::pkgdown, local::.
35-
needs: website
33+
- uses: r-lib/actions/setup-renv@v2
34+
35+
- name: Install CI extras (pkgdown)
36+
run: |
37+
pkgs <- c("pkgdown")
38+
for (p in pkgs) {
39+
if (!requireNamespace(p, quietly = TRUE)) {
40+
install.packages(p, repos = "https://packagemanager.posit.co/cran/latest")
41+
}
42+
}
43+
shell: Rscript {0}
3644

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

.github/workflows/test-coverage.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,20 @@ jobs:
3939

4040
- uses: r-lib/actions/setup-r@v2
4141
with:
42+
r-version: '4.2.3'
4243
use-public-rspm: true
4344

44-
- uses: r-lib/actions/setup-r-dependencies@v2
45-
with:
46-
extra-packages: any::covr
47-
needs: coverage
45+
- uses: r-lib/actions/setup-renv@v2
46+
47+
- name: Install CI extras (covr)
48+
run: |
49+
pkgs <- c("covr")
50+
for (p in pkgs) {
51+
if (!requireNamespace(p, quietly = TRUE)) {
52+
install.packages(p, repos = "https://packagemanager.posit.co/cran/latest")
53+
}
54+
}
55+
shell: Rscript {0}
4856

4957
- name: Install migrate
5058
run: |
@@ -73,7 +81,7 @@ jobs:
7381

7482
- name: Upload test results
7583
if: failure()
76-
uses: actions/upload-artifact@v3
84+
uses: actions/upload-artifact@v4
7785
with:
7886
name: coverage-test-failures
7987
path: ${{ runner.temp }}/package

.lintr

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
linters: linters_with_defaults(
2-
line_length_linter = line_length_linter(120),
3-
object_usage_linter = NULL
4-
)
1+
linters: lintr::linters_with_defaults(cyclocomp_linter = lintr::cyclocomp_linter(), line_length_linter = lintr::line_length_linter(120), return_linter = NULL, commas_linter = NULL, infix_spaces_linter = NULL, object_usage_linter = NULL)
2+
exclusions: list("vignettes/")

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"files.watcherExclude": {
33
"**/renv/**": true
4-
}
4+
},
5+
"r.lsp.promptToInstall": false
56
}

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: unbiased
22
Title: Unbiased: Production-Grade Randomization API
3-
Version: 1.0.1
3+
Version: 1.0.2
44
Authors@R: c(
55
person("Kamil", "Sijko", , "kamil.sijko@ttsi.com.pl",
66
role = c("aut", "cre"), comment = c(ORCID = "0000-0002-2203-1065")),

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# unbiased 1.0.2
2+
3+
## Bug Fixes
4+
5+
- Fixed incorrect ratio allocation in minimisation randomization when unequal allocation ratios were provided. This was caused by a logic bug; updating a single line in `randomize-minimisation-pocock.R` restores expected allocation behavior.
6+
17
# unbiased 1.0.1
28

39
## Bug Fixes

R/randomize-minimisation-pocock.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ randomize_minimisation_pocock <-
253253
# compute scenario where each arm (x) gets new subject
254254
dplyr::mutate(dplyr::across(
255255
dplyr::where(is.numeric),
256-
~ dplyr::if_else(arm == x, .x + 1, .x) *
256+
~ dplyr::if_else(arm == x, .x + 1, .x) /
257257
ratio[arm]
258258
)) |>
259259
# compute dispersion across each covariate

inst/plumber/unbiased_api/plumber.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#* url = "https://ttscience.github.io/unbiased/")
1111
#* @apiLicense list(name = "MIT",
1212
#* url = "https://github.com/ttscience/unbiased/LICENSE.md")
13-
#* @apiVersion 1.0.1
13+
#* @apiVersion 1.0.2
1414
#* @apiTag initialize Endpoints that initialize study with chosen
1515
#* randomization method and parameters.
1616
#* @apiTag randomize Endpoints that randomize individual patients after the

0 commit comments

Comments
 (0)