Skip to content

Commit 37fbd1e

Browse files
committed
Merge branch 'develop' into lemireg/pw_test_bin-sampsize
2 parents 5018402 + cf85954 commit 37fbd1e

22 files changed

+226
-145
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
- {os: windows-latest, r: 'release'}
2323
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
2424
- {os: ubuntu-latest, r: 'release'}
25-
- {os: ubuntu-latest, r: '4.0.4', pandoc-version: '2.11.4'}
25+
- {os: ubuntu-latest, r: '4.4.2', pandoc-version: '3.2'}
26+
- {os: ubuntu-latest, r: '4.1.0', pandoc-version: '2.11.4'}
2627

2728
env:
2829
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -31,14 +32,14 @@ jobs:
3132
steps:
3233
- uses: actions/checkout@v4
3334

34-
- name: Setup statsrv pandoc
35-
if: ${{ matrix.config.r == '4.0.4' }}
35+
- name: Setup custom pandoc version
36+
if: ${{ matrix.config.pandoc-version != null }}
3637
uses: r-lib/actions/setup-pandoc@v2
3738
with:
3839
pandoc-version: ${{ matrix.config.pandoc-version }}
3940

40-
- name: Setup default pandoc
41-
if: ${{ matrix.config.r != '4.0.4' }}
41+
- name: Setup default pandoc version
42+
if: ${{ matrix.config.pandoc-version == null }}
4243
uses: r-lib/actions/setup-pandoc@v2
4344

4445
- name: Set up tinytex
@@ -53,15 +54,15 @@ jobs:
5354
5455
- name: Setup recent R
5556
uses: r-lib/actions/setup-r@v2
56-
if: ${{ matrix.config.r != '4.0.4' }}
57+
if: ${{ matrix.config.r != '4.1.0' && matrix.config.r != '4.4.2'}}
5758
with:
5859
r-version: ${{ matrix.config.r }}
5960
http-user-agent: ${{ matrix.config.http-user-agent }}
6061
use-public-rspm: true
6162

62-
- name: Setup R 4.0.4
63+
- name: Setup older R
6364
uses: r-lib/actions/setup-r@v2
64-
if: ${{ matrix.config.r == '4.0.4' }}
65+
if: ${{ matrix.config.r == '4.1.0' || matrix.config.r == '4.4.2'}}
6566
with:
6667
r-version: ${{ matrix.config.r }}
6768
cran: 'https://packagemanager.posit.co/cran/__linux__/noble/2024-04-19'

DESCRIPTION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: VISCfunctions
3-
Title: VISC STP/SRA functions
4-
Version: 1.3.0.9000
3+
Title: VISCfunctions
4+
Version: 1.3.1.9000
55
Authors@R: c(
66
person("Bryan", "Mayer", , "bmayer@fredhutch.org", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-2258-5276")),
77
person("Dave", "Slager", , "dslager@fredhutch.org", role = "aut", comment = c(ORCID = "0000-0003-2525-2039")),
@@ -15,10 +15,10 @@ Authors@R: c(
1515
person("Jimmy", "Fulp", , , role = "aut")
1616
)
1717
Description:
18-
Statistical, data processing, and annotation functions for VISC.
18+
Statistical, data processing, and annotation functions for VISC statisticians and programmers.
1919
License: MIT + file LICENSE
2020
Depends:
21-
R (>= 3.5)
21+
R (>= 4.1.0)
2222
Imports:
2323
binom,
2424
coin,

NEWS.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
# VISCfunctions (development version)
22

33
* Add `SampleSizes` output to `pairwise_test_bin()` (#130)
4-
54
* Maintenance of package and CI (#114)
5+
* Minor updates to vignette (#141)
6+
* Update title and description in package DESCRIPTION file (#139)
7+
* Add `Median_Quartiles` to `pairwise_test_cont()` output (#99)
8+
* Minor Changes:
9+
* Update `Overview()` to include new `Median_Quartiles` (#99)
10+
11+
# VISCfunctions 1.3.1
12+
13+
* Report loaded and attached packages in package reproducibility table (#132)
14+
* Report nodename in platform reproducibility table (#121)
615
* Add B cell example dataset from G001 flow and sequencing file (#108)
16+
* Maintenance of package and CI (#114, #116, #124)
17+
* VISCfunctions now depends on R >= 4.1.0 (#134)
18+
* Auto-generate VISCfunctions pkgdown website with GitHub Actions (#119)
719

820
# VISCfunctions 1.3.0
921

@@ -63,7 +75,7 @@
6375
* New Functions:
6476
* `escape()` to easily make latex friendly columns with `\` in front of special characters
6577
* `wilson_ci()` function for Wilson Confident Intervals
66-
* `pariwise_test_bin()` for pairwise binary testing comparisons (i.e. pairwise group differences in response rates)
78+
* `pairwise_test_bin()` for pairwise binary testing comparisons (i.e. pairwise group differences in response rates)
6779
* Minor Changes:
6880
* Adding suffix param to `stat_paste()`. Now easy to add % or something else after each stat, if needed
6981
* Improved documentation and minor fixes to `two_samp_cont_test()`

R/pairwise_comparisons.R

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ pairwise_test_cont <- function(
262262
Group2_median = 10^stats::median(log10(j_vals), na.rm = T),
263263
Group1_max = max(i_vals, na.rm = T),
264264
Group2_max = max(j_vals, na.rm = T),
265+
Group1_q1 = stats::quantile(i_vals, probs = c(.25), na.rm = T),
266+
Group2_q1 = stats::quantile(j_vals, probs = c(.25), na.rm = T),
267+
Group1_q3 = stats::quantile(i_vals, probs = c(.75), na.rm = T),
268+
Group2_q3 = stats::quantile(j_vals, probs = c(.75), na.rm = T),
265269
Group1_mean = 10^mean(log10(i_vals), na.rm = T),
266270
Group2_mean = 10^mean(log10(j_vals), na.rm = T),
267271
Group1log_mean = mean(log10(i_vals), na.rm = T),
@@ -283,6 +287,10 @@ pairwise_test_cont <- function(
283287
Group2_max = max(j_vals, na.rm = T),
284288
Group1_mean = mean(i_vals, na.rm = T),
285289
Group2_mean = mean(j_vals, na.rm = T),
290+
Group1_q1 = stats::quantile(i_vals, probs = c(.25), na.rm = T),
291+
Group2_q1 = stats::quantile(j_vals, probs = c(.25), na.rm = T),
292+
Group1_q3 = stats::quantile(i_vals, probs = c(.75), na.rm = T),
293+
Group2_q3 = stats::quantile(j_vals, probs = c(.75), na.rm = T),
286294
Group1_sd = stats::sd(i_vals, na.rm = T),
287295
Group2_sd = stats::sd(j_vals, na.rm = T)
288296
)
@@ -328,10 +336,9 @@ pairwise_test_cont <- function(
328336
if (length(results_list) == 0) return(NULL)
329337

330338
results <- do.call(base::rbind, results_list)
331-
332339
# Pasting together stats
333340
pasted_results <- paste_tbl_grp(
334-
data = results, vars_to_paste = c("n","median_min_max",'mean'),
341+
data = results, vars_to_paste = c("n","median_min_max",'mean', "median_quartiles"),
335342
first_name = 'Group1', second_name = 'Group2', sep_val = sep_val,
336343
alternative = alternative, digits = digits, trailing_zeros = trailing_zeros,
337344
keep_all = TRUE, verbose = verbose)
@@ -358,6 +365,7 @@ pairwise_test_cont <- function(
358365
Comparison = pasted_results$Comparison,
359366
SampleSizes = pasted_results$n_comparison,
360367
Median_Min_Max = pasted_results$median_min_max_comparison,
368+
Median_Quartiles = pasted_results$median_quartiles,
361369
Mean = pasted_results$mean_comparison,
362370
log_Mean_SD = pasted_results_extra$mean_sd_comparison,
363371
MagnitudeTest = results$MagnitudeTest,
@@ -383,6 +391,7 @@ pairwise_test_cont <- function(
383391
Comparison = pasted_results$Comparison,
384392
SampleSizes = pasted_results$n_comparison,
385393
Median_Min_Max = pasted_results$median_min_max_comparison,
394+
Median_Quartiles = pasted_results$median_quartiles_comparison,
386395
Mean_SD = pasted_results_extra$mean_sd_comparison,
387396
MagnitudeTest = results$MagnitudeTest,
388397
PerfectSeparation = results$PerfectSeparation,
@@ -778,10 +787,9 @@ pairwise_test_bin <- function(x,
778787
#' exampleData_BAMA |>
779788
#' filter(visitno != 0) |>
780789
#' group_by(group, visitno) |>
781-
#' summarize(
790+
#' reframe(
782791
#' cor_test_pairs(x = magnitude, pair = antigen, id = pubID,
783-
#' method = 'spearman', n_distinct_value = 3, digits = 1, verbose = TRUE),
784-
#' .groups = 'drop'
792+
#' method = 'spearman', n_distinct_value = 3, digits = 1, verbose = TRUE)
785793
#' )
786794
#'
787795
#' @export

R/pretty_output_functions.R

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' Pasting Together Information for Two Groups
22
#'
3-
#' Paste together information, often statistics, from two groups. There are two
4-
#' predefined combinations: mean(sd) and median\[min, max\], but user may also
3+
#' Paste together information, often statistics, from two groups. There are three
4+
#' predefined combinations: mean(sd) and median\[min, max\] and median\[first quartile, third quartile\], but user may also
55
#' paste any single measure together.
66
#'
77
#'
@@ -32,7 +32,7 @@
3232
#' @param verbose a logical variable indicating if warnings and messages should be displayed. Default FALSE.
3333
#' @details
3434
#'
35-
#' User must use consistant naming throughout, with a underscore to separate the group names from the measures (i.e. `Group1_mean` and `Group2_mean`). There also must be columns defining the group names (i.e. `Group1` and `Group2`), which are used to form the `Comparison` variable.
35+
#' User must use consistent naming throughout, with a underscore to separate the group names from the measures (i.e. `Group1_mean` and `Group2_mean`). There also must be columns defining the group names (i.e. `Group1` and `Group2`), which are used to form the `Comparison` variable.
3636
#'
3737
#' `alternative` included as a parameter so the direction can easily be seen in one-sided test. If "two.sided" is selected the value to be pasted between the two group names will be set to `sep_val`, where "greater" will use " > " and "less" with use " < " as the pasting value.
3838
#'
@@ -137,6 +137,9 @@ paste_tbl_grp <- function(
137137
vars_to_paste_here <- c(vars_to_paste_here, 'median_min_max')
138138
if (sum(vars_to_paste_here %in% c('mean','sd')) == 2)
139139
vars_to_paste_here <- c(vars_to_paste_here, 'mean_sd')
140+
if (sum(vars_to_paste_here %in% c('median','q1','q3')) == 3)
141+
vars_to_paste_here <- c(vars_to_paste_here, 'median_quartiles')
142+
140143

141144
if (verbose) message('The following measures will be combined: ',
142145
paste0(vars_to_paste_here, collapse = ', '))
@@ -151,11 +154,14 @@ paste_tbl_grp <- function(
151154

152155
# Need to define which variables to check. Special considerations for the predefined values
153156
vars_to_check <- vars_to_paste_here[!vars_to_paste_here %in%
154-
c('median_min_max','mean_sd')]
157+
c('median_min_max','median_quartiles','mean_sd')]
155158
if (any(vars_to_paste_here == 'median_min_max'))
156159
vars_to_check <- unique(c(vars_to_check, 'median', 'min', 'max'))
157160
if (any(vars_to_paste_here == 'mean_sd'))
158161
vars_to_check <- unique(c(vars_to_check, 'mean', 'sd'))
162+
if (any(vars_to_paste_here == 'median_quartiles'))
163+
vars_to_check <- unique(c(vars_to_check, 'median', 'q1','q3'))
164+
159165

160166
# Need to check the group1 and group2 version of each variable being pasted
161167
group1_vars_to_check <- paste0(first_name, '_', vars_to_check)
@@ -223,7 +229,23 @@ paste_tbl_grp <- function(
223229
trailing_zeros = trailing_zeros
224230
)
225231
)
226-
} else {
232+
} else if (vars_to_paste_here[i] == 'median_quartiles') {
233+
pasted_results[[i]] <- paste0(
234+
stat_paste(stat1 = data_here[, paste0(first_name, '_median')],
235+
stat2 = data_here[, paste0(first_name, '_q1')],
236+
stat3 = data_here[, paste0(first_name, '_q3')],
237+
digits = digits, bound_char = '[', sep = ', ',
238+
na_str_out = na_str_out, trailing_zeros = trailing_zeros
239+
),
240+
sep_val,
241+
stat_paste(stat1 = data_here[, paste0(second_name, '_median')],
242+
stat2 = data_here[, paste0(second_name, '_q1')],
243+
stat3 = data_here[, paste0(second_name, '_q3')],
244+
digits = digits, bound_char = '[', sep = ', ',
245+
na_str_out = na_str_out, trailing_zeros = trailing_zeros
246+
)
247+
)
248+
} else {
227249
first_var_here <- data_here[, paste0(first_name, '_', vars_to_paste_here[i])]
228250
second_var_here <- data_here[, paste0(second_name, '_', vars_to_paste_here[i])]
229251
both_var_here <- c(first_var_here, second_var_here)

R/reproducibility_tables.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,8 @@ get_session_info <- function(libpath = FALSE){
127127
Sys.getenv("USERNAME"),
128128
Sys.getenv("USER")))
129129

130-
my_session_info <- sessioninfo::session_info()
131-
132-
platform <- my_session_info[[1]]
133-
packages <- my_session_info[[2]]
130+
platform <- sessioninfo::platform_info()
131+
packages <- sessioninfo::package_info(pkgs = 'loaded', include_base = FALSE)
134132

135133
# TABLE 1
136134
my_session_info1 <- rbind(
@@ -222,8 +220,8 @@ get_session_info <- function(libpath = FALSE){
222220

223221

224222
# TABLE 2
225-
my_session_info2 <- packages[packages$attached,] # Only want attached packages
226-
my_session_info2 <- with(my_session_info2, {
223+
224+
my_session_info2 <- with(packages, {
227225
data.frame(package = package,
228226
version = loadedversion,
229227
# Pulling in Data Version numbers
@@ -238,6 +236,7 @@ get_session_info <- function(libpath = FALSE){
238236
USE.NAMES = FALSE),
239237
date = date,
240238
source = source,
239+
status = ifelse(attached, 'attached', 'loaded'),
241240
libpath = library)
242241
})
243242
if (! libpath) my_session_info2$libpath <- NULL
@@ -248,6 +247,9 @@ get_session_info <- function(libpath = FALSE){
248247
# Use short git hash
249248
my_session_info2$source <- shorten_git_hash(my_session_info2$source)
250249

250+
my_session_info2 <- my_session_info2[order(my_session_info2$status),]
251+
rownames(my_session_info2) <- NULL
252+
251253
list(platform_table = my_session_info1, packages_table = my_session_info2)
252254
}
253255

man/VISCfunctions-package.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/VISCfunctions.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/collapse_group_row.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/cor_test_pairs.Rd

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)