Skip to content

Commit 2fade8c

Browse files
committed
Bump version to 1.24.2, update NEWS, refine tests
1 parent 8161dd0 commit 2fade8c

3 files changed

Lines changed: 19 additions & 24 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Package: netdiffuseR
22
Title: Analysis of Diffusion and Contagion Processes on Networks
3-
Version: 1.24.1
3+
Version: 1.24.2
44
Authors@R: c(
55
person("George", "Vega Yon", email="g.vegayon@gmail.com", role=c("aut", "cre"),
66
comment=c(ORCID = "0000-0002-3171-0844", what="Rewrite functions with Rcpp, plus new features")
77
),
88
person("Thomas", "Valente", email="tvalente@usc.edu", role=c("aut", "cph"),
99
comment=c(ORCID="0000-0002-8824-5816", what="R original code")),
1010
person("Anibal", "Olivera Morales", role = c("aut", "ctb"),
11-
comment=c(ORCID="0009-0000-3736-7939", what="Multi-diffusion version")),
11+
comment=c(ORCID="0009-0000-3736-7939", what="Developer from V1.23.0")),
1212
person("Stephanie", "Dyal", email="stepharp@usc.edu", role=c("ctb"), comment="Package's first version"),
1313
person("Timothy", "Hayes", email="timothybhayes@gmail.com", role=c("ctb"), comment="Package's first version")
1414
)

NEWS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# Changes in netdiffuseR version 1.24.2 (2026-03-09)
2+
3+
* New function `collapse_timeframes()`: aggregates high-resolution or
4+
continuous-time longitudinal edgelists into discrete time windows, ready
5+
for use with `edgelist_to_adjmat()` or `as_diffnet()`.
6+
7+
* New dataset `epigames` and `epigamesDiffNet`: a simulated epidemic game
8+
network with 594 nodes and 15 time periods from the WKU Epi Games study.
9+
10+
* New dataset `wku_diffnet`: a `diffnet` object from the WKU simulation study.
11+
112
# Changes in netdiffuseR version 1.24.1 (2026-03-03)
213

314
* Fixed CRAN example error in `round_to_seq()`: `plot(w, x)` replaced with

tests/testthat/test-collapse_timeframes.R

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
################################################################################
2-
# Tests for collapse_timeframes()
3-
################################################################################
4-
51
context("collapse_timeframes: collapsing longitudinal edgelists")
62

73
# Base edgelist used across most tests:
@@ -15,9 +11,7 @@ el <- data.frame(
1511
weight = c(1, 1, 1, 1, 1, 1, 1, 1)
1612
)
1713

18-
################################################################################
19-
# Block 1: Output structure
20-
################################################################################
14+
# Block 1: Output structure -----------------------------------------------
2115

2216
test_that("collapse_timeframes returns a data.frame", {
2317
result <- collapse_timeframes(el, ego = "sender", alter = "receiver",
@@ -47,9 +41,7 @@ test_that("output has fewer or equal rows than input after collapsing", {
4741
expect_lte(nrow(result), nrow(el))
4842
})
4943

50-
################################################################################
51-
# Block 2: Binning logic (window_size)
52-
################################################################################
44+
# Block 2: Binning logic (window_size) ------------------------------------
5345

5446
test_that("window_size=1 does not merge periods", {
5547
result <- collapse_timeframes(el, ego = "sender", alter = "receiver",
@@ -86,9 +78,7 @@ test_that("aggregated weight is sum of constituent weights", {
8678
expect_equal(result$weight, 1.0)
8779
})
8880

89-
################################################################################
90-
# Block 3: relative_time TRUE / FALSE
91-
################################################################################
81+
# Block 3: relative_time TRUE / FALSE -------------------------------------
9282

9383
# Edgelist with a gap: time points 1, 2, 5, 6 (no 3 or 4)
9484
el_gap <- data.frame(
@@ -112,9 +102,7 @@ test_that("relative_time=FALSE preserves original bin values (may have gaps)", {
112102
expect_false(identical(sort(unique(result$time)), 1:4))
113103
})
114104

115-
################################################################################
116-
# Block 4: Time column parsing (integer, POSIXct, character string)
117-
################################################################################
105+
# Block 4: Time column parsing (integer, POSIXct, character string) -------
118106

119107
test_that("integer time column is handled", {
120108
el_int <- el
@@ -148,9 +136,7 @@ test_that("character time with time_format is parsed correctly", {
148136
expect_equal(length(unique(result$time)), 2L)
149137
})
150138

151-
################################################################################
152-
# Block 5: weightvar = NULL (count mode) vs explicit weight column
153-
################################################################################
139+
# Block 5: weightvar = NULL (count mode) vs explicit weight column --------
154140

155141
test_that("weightvar=NULL counts interactions as weight", {
156142
el_now <- data.frame(
@@ -186,9 +172,7 @@ test_that("explicit weight column is summed correctly", {
186172
expect_equal(result$w, 10)
187173
})
188174

189-
################################################################################
190-
# Block 6: Edge cases and error handling
191-
################################################################################
175+
# Block 6: Edge cases and error handling ----------------------------------
192176

193177
test_that("NAs in time column produce a warning", {
194178
el_na <- el

0 commit comments

Comments
 (0)