Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Package: migraph
Title: Inferential Methods for Multimodal and Other Networks
Version: 1.6.5
Version: 1.6.6
Description: A set of tools for testing networks.
It includes functions for univariate and multivariate
conditional uniform graph and quadratic assignment procedure testing,
and network regression.
It includes functions for univariate and multivariate conditional uniform graph
and quadratic assignment procedure testing, and network regression.
The package is a complement to
'Multimodal Political Networks' (2021, ISBN:9781108985000),
and includes various datasets used in the book.
Expand All @@ -20,7 +19,7 @@ LazyData: true
Depends:
R (>= 4.1.0),
manynet (>= 2.1.2),
autograph (>= 0.4.0),
autograph (>= 1.0.0),
netrics (>= 0.3.1)
Imports:
dplyr (>= 1.1.0),
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# migraph 1.6.6

2026-06-23

## Package

- Improved goodpractices
- Dropped netrics tutorial testing

# migraph 1.6.5

2026-06-22
Expand Down
2 changes: 2 additions & 0 deletions R/class_makes.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ print.diffs_model <- function(x, ...){
x <- x[,colSums(x, na.rm=TRUE) != 0]
x$I_new <- NULL
print(dplyr::tibble(x, ...))
invisible(x)
}

## Over ####
Expand All @@ -37,6 +38,7 @@ make_over_memb <- function(out, categ) {
#' @export
print.over_memb <- function(x, ...){
print(round(unclass(x),3), ...)
invisible(x)
}


2 changes: 2 additions & 0 deletions R/class_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ print.netlm <- function(x, ...){
print(tidy(x))
cat("\n# Model summary statistics\n")
print(glance(x))
invisible(x)
}

#' @export
Expand All @@ -274,6 +275,7 @@ print.netlogit <- function(x, ...){
print(tidy(x))
cat("\n# Model summary statistics\n")
print(glance(x))
invisible(x)
}

# Unused because infinite recursion through summary.ergm() in tidy.ergm()
Expand Down
1 change: 1 addition & 0 deletions R/model_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,6 @@ print.network_test <- function(x, ...,
cat("Observed Value:", x$testval, "\n")
cat("Pr(X>=Obs):", x$pgteobs, "\n")
cat("Pr(X<=Obs):", x$plteobs, "\n\n")
invisible(x)
}

4 changes: 4 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@

- Updated manynet dependency to 1.2.1 to fix reverse dependency issue
- Updated netrics dependency to 0.3.1 to fix reverse dependency issue
- Checked with CRAN versions of dependencies
- Only issue was CRAN versions of manynet and netrics built under R v4.6.1,
whereas this package was built locally under R v4.6.0,
though this should not be a problem for CRAN submission.
Comment on lines 12 to +17
9 changes: 6 additions & 3 deletions inst/tutorials/tutorial0/tutorial0.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
Remove the hash symbol at the start of this line to run it:

```{r comments, exercise = TRUE}
# 1/5 # this will still be commented...

Check warning on line 108 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for windows-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=108,col=3,[commented_code_linter] Remove commented code.

Check warning on line 108 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=108,col=3,[commented_code_linter] Remove commented code.
```

In an R script you can toggle commenting for one or more lines using Cmd-Shift-C/Ctrl-Shift-C.
Expand Down Expand Up @@ -148,9 +148,9 @@
In R, we can write such logical statements as:

```{r equivalence, exercise = TRUE}
"James"=="james" # Try also "James"!="james"

Check warning on line 151 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for windows-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=151,col=8,[infix_spaces_linter] Put spaces around all infix operators.

Check warning on line 151 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=151,col=8,[infix_spaces_linter] Put spaces around all infix operators.
# Other logical statements include: ">", ">=", "<=", "<".
# 1 < 5 # Try also "1 <= 5"

Check warning on line 153 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for windows-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=153,col=3,[commented_code_linter] Remove commented code.

Check warning on line 153 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=153,col=3,[commented_code_linter] Remove commented code.
```

Logical values are always either `TRUE` or `FALSE`,
Expand All @@ -168,10 +168,11 @@

```{r assignment, exercise = TRUE}
surname <- "Hollway"
y.chromosome <- T # or TRUE

Check warning on line 171 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for windows-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=171,col=18,[T_and_F_symbol_linter] Use TRUE instead of the symbol T.

Check warning on line 171 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for windows-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=171,col=1,[object_name_linter] Variable and function name style should match snake_case or symbols.

Check warning on line 171 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=171,col=18,[T_and_F_symbol_linter] Use TRUE instead of the symbol T.

Check warning on line 171 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=171,col=1,[object_name_linter] Variable and function name style should match snake_case or symbols.
siblings <- 1
age <- NA # This is used for missing information
# Note that these objects then appear in RStudio's environment pane (by default the top right)
# Note that these objects then appear in RStudio's environment pane

Check warning on line 174 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for windows-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=174,col=68,[trailing_whitespace_linter] Remove trailing whitespace.

Check warning on line 174 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=174,col=68,[trailing_whitespace_linter] Remove trailing whitespace.
# (by default the top right)
```

You can then recover this information by simply calling these objects:
Expand All @@ -186,7 +187,7 @@
And even operate on them:

```{r mult, exercise = TRUE, exercise.setup = "assignment"}
siblings*3

Check warning on line 190 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for windows-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=190,col=9,[infix_spaces_linter] Put spaces around all infix operators.

Check warning on line 190 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=190,col=9,[infix_spaces_linter] Put spaces around all infix operators.
# Try multiplying the other objects by 3
```

Expand All @@ -211,10 +212,11 @@
```{r series, exercise = TRUE}
teenageyrs <- 13:19
teenageqrtrs <- seq(13, 19.99, by = 0.25)
# We can recall every third value from this object using a repeating vector

Check warning on line 215 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for windows-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=215,col=76,[trailing_whitespace_linter] Remove trailing whitespace.

Check warning on line 215 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=215,col=76,[trailing_whitespace_linter] Remove trailing whitespace.
teenageqrtrs
teenageqrtrs[c(FALSE, FALSE, TRUE)]
# teenageqrtrs[c(F, F, T)] # Also works but it is best practice to write out the logic.
# teenageqrtrs[c(F, F, T)]

Check warning on line 218 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for windows-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=218,col=27,[trailing_whitespace_linter] Remove trailing whitespace.

Check warning on line 218 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for windows-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=218,col=3,[commented_code_linter] Remove commented code.

Check warning on line 218 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=218,col=27,[trailing_whitespace_linter] Remove trailing whitespace.

Check warning on line 218 in inst/tutorials/tutorial0/tutorial0.Rmd

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

file=inst/tutorials/tutorial0/tutorial0.Rmd,line=218,col=3,[commented_code_linter] Remove commented code.
# Also works but it is best practice to write out the logic.
```

So R can help us store and recall values and even vectors of values,
Expand Down Expand Up @@ -327,7 +329,8 @@
You can also add lists to a list:

```{r list-nest, exercise = TRUE, exercise.setup="list-names"}
mylist$Lived <- list(c("New Zealand", "UK", "New Zealand", "Germany", "UK", "Switzerland"), NA)
mylist$Lived <- list(c("New Zealand", "UK", "New Zealand",
"Germany", "UK", "Switzerland"), NA)
```

Note that we've been using parentheses, `()`, here and not brackets, `[]`,
Expand Down
2 changes: 1 addition & 1 deletion inst/tutorials/tutorial8/diversity.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ learnr::random_phrases_add(language = "en",
"Beau travail!",
"Bravo!",
"Super!"),
encouragement = c("Bon effort"))
encouragement = "Bon effort")
marvel_friends <- to_unsigned(to_uniplex(fict_marvel, "relationship"), keep = "positive")
marvel_friends <- to_giant(marvel_friends)
marvel_friends <- marvel_friends %>% to_subgraph(Appearances >= mean(Appearances))
Expand Down
10 changes: 5 additions & 5 deletions inst/tutorials/tutorial9/ergm.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ learnr::random_phrases_add(language = "en",
"Beau travail!",
"Bravo!",
"Super!"),
encouragement = c("Bon effort"))
encouragement = "Bon effort")
```

## This tutorial
Expand Down Expand Up @@ -282,10 +282,10 @@ how much change there is depends critically on “where you are on the curve”.
```{r predprobplot, echo = F, fig.height=3, fig.width=8, purl = FALSE}
ggplot(data.frame(x = c(-4, 4)), aes(x = x)) +
ggplot2::stat_function(fun = plogis, colour = "blue") +
ggplot2::geom_line(aes(x = 0, y=c(.5,.73), colour = "+1 unit change @0")) +
ggplot2::geom_line(aes(x = c(0,1), y=.73, colour = "+1 unit change @0")) +
ggplot2::geom_line(aes(x = 1, y=c(.73,.88), colour = "+1 unit change @1")) +
ggplot2::geom_line(aes(x = c(1,2), y=.88, colour = "+1 unit change @1")) +
ggplot2::geom_line(aes(x = 0, y=c(0.5,.73), colour = "+1 unit change @0")) +
ggplot2::geom_line(aes(x = c(0,1), y=0.73, colour = "+1 unit change @0")) +
ggplot2::geom_line(aes(x = 1, y=c(0.73,0.88), colour = "+1 unit change @1")) +
ggplot2::geom_line(aes(x = c(1,2), y=0.88, colour = "+1 unit change @1")) +
ggplot2::theme_minimal()
```

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-model_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_that("test_random works", {
# Set the cugtest up
# Test stuff cug1
expect_equal(as.numeric(cugtest$testval), -0.85714, tolerance = 0.001)
expect_equal(length(cugtest$testdist), 200) # NB: Stochastic
expect_length(cugtest$testdist, 200) # NB: Stochastic
expect_false(cugtest$mode)
expect_false(cugtest$diag)
expect_equal(cugtest$cmode, "edges")
Expand All @@ -28,7 +28,7 @@ test_that("test_random works", {
# Test stuff cug2
expect_equal(as.numeric(cugtest2$testval), 0.2375, tolerance = 0.001)
# expect_equal(mean(cugtest3$testdist), 0.3600, tolerance = 0.02)
expect_equal(length(cugtest2$testdist), 200) # NB: Stochastic
expect_length(cugtest2$testdist, 200) # NB: Stochastic
expect_false(cugtest2$mode)
expect_false(cugtest2$diag)
expect_equal(cugtest2$cmode, "edges")
Expand All @@ -46,9 +46,9 @@ qaptest <- test_permutation(marvel_friends,

test_that("test_permutation works", {
expect_equal(as.numeric(qaptest$testval), -0.85714, tolerance = 0.001)
expect_equal(length(qaptest$testdist), 200) # NB: Stochastic
expect_equal(class(qaptest$plteobs), "numeric") # NB: Stochastic
expect_equal(class(qaptest$pgteobs), "numeric") # NB: Stochastic
expect_length(qaptest$testdist, 200) # NB: Stochastic
expect_equal(qaptest$reps, 200)
expect_s3_class(qaptest, "network_test")
})
Expand All @@ -62,9 +62,9 @@ test_that("test_configuration works", {
times = 200)
expect_s3_class(configtest, "network_test")
expect_equal(as.numeric(configtest$testval), -0.85714, tolerance = 0.001)
expect_equal(length(configtest$testdist), 200) # NB: Stochastic
expect_equal(class(configtest$plteobs), "numeric") # NB: Stochastic
expect_equal(class(configtest$pgteobs), "numeric") # NB: Stochastic
expect_length(configtest$testdist, 200) # NB: Stochastic
})


Expand Down
13 changes: 0 additions & 13 deletions tests/testthat/test-tutorials_netrics.R

This file was deleted.

Loading