Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
5 changes: 5 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ vignettes/precompile\.R
^CRAN-SUBMISSION$
^README\.Rmd$
^.mailmap$
^\.positai$
^\.claude$
^CLAUDE\.md$
^\.Rhistory$
^\.RData$
576 changes: 530 additions & 46 deletions .github/CONTRIBUTING.md

Large diffs are not rendered by default.

15 changes: 2 additions & 13 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@

# Checklist:

- PR form
- [ ] Description above itemizes changes under subtitles, e.g. "## Data""
- [ ] Any closed, fixed, or related issues are referenced and explained in the description above, e.g. "Fixed #0 by adding A"
- [ ] Package builds on my OS without issues
- PR checks all pass for latest commit
- [ ] CodeFactor check: Package improves or maintains good style
- [ ] Package builds on Mac
- [ ] Package builds on Windows
- [ ] Package builds on Linux
- [ ] CodeCov check: Package improves or maintains good test coverage
- Documentation
- [ ] Any new or modified functions or data have roxygen style documentation in their .R scripts
- [ ] Longer functions are commented inline or broken down into helper functions so that it is easier to debug in the future
- [ ] Longer functions are commented inline or broken down into helper functions to help debugging
- PR form
- [ ] PR description above and the NEWS.md file are aligned
- [ ] DESCRIPTION file version is bumped by the appropriate increment (major, minor, patch)
58 changes: 55 additions & 3 deletions .github/workflows/prchecks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v7

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

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

Expand All @@ -40,6 +42,7 @@ jobs:
any::rcmdcheck

- uses: r-lib/actions/check-r-package@v2
env:
_R_CHECK_FORCE_SUGGESTS_: false
with:
upload-snapshots: true
Expand All @@ -53,13 +56,16 @@ jobs:
shell: Rscript {0}

- name: Save binary artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.config.asset_name }}
path: build/

- name: Calculate code coverage
run: Rscript -e "covr::codecov()"
if: runner.os == 'macOS'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: Rscript -e 'covr::codecov(token = Sys.getenv("CODECOV_TOKEN"))'

- name: Lint
run: lintr::lint_package()
Expand All @@ -68,3 +74,49 @@ jobs:
- name: Spell check
run: spelling::spell_check_package()
shell: Rscript {0}

pr-metadata:
name: PR metadata checks
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Check DESCRIPTION version is bumped
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
BASE_VERSION=$(git show "$BASE_SHA:DESCRIPTION" | grep -m1 '^Version:' | sed 's/Version: *//')
HEAD_VERSION=$(grep -m1 '^Version:' DESCRIPTION | sed 's/Version: *//')
echo "Base version: $BASE_VERSION"
echo "Head version: $HEAD_VERSION"
if [ "$BASE_VERSION" = "$HEAD_VERSION" ]; then
echo "::error::DESCRIPTION Version has not been bumped from $BASE_VERSION"
exit 1
fi
HIGHEST=$(printf '%s\n%s\n' "$BASE_VERSION" "$HEAD_VERSION" | sort -V | tail -n1)
if [ "$HIGHEST" != "$HEAD_VERSION" ]; then
echo "::error::DESCRIPTION Version $HEAD_VERSION is not greater than base version $BASE_VERSION"
exit 1
fi

- name: Check PR title mentions the new version number
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
HEAD_VERSION=$(grep -m1 '^Version:' DESCRIPTION | sed 's/Version: *//')
if [[ "$PR_TITLE" != *"$HEAD_VERSION"* ]]; then
echo "::error::PR title does not mention the new version number ($HEAD_VERSION): \"$PR_TITLE\""
exit 1
fi

- name: Check PR description itemizes changes under subsection titles
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
if ! grep -qE '^##[[:space:]]' <<< "$PR_BODY"; then
echo "::error::PR description does not itemize changes under subsection titles (e.g. \"## Data\")"
exit 1
fi
40 changes: 28 additions & 12 deletions .github/workflows/pushrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v7

- uses: r-lib/actions/setup-r@v2
with:
Expand Down Expand Up @@ -55,14 +55,16 @@ jobs:
shell: Rscript {0}

- name: Save binary artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.config.asset_name }}
path: build/

- name: Calculate code coverage
if: runner.os == 'macOS-latest'
run: Rscript -e "covr::codecov()"
if: runner.os == 'macOS'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: Rscript -e 'covr::codecov(token = Sys.getenv("CODECOV_TOKEN"))'

release:
name: Bump version and release
Expand All @@ -73,7 +75,7 @@ jobs:
contents: write
steps:
- name: Checkout one
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
fetch-depth: '0'
- name: Bump version and push tag
Expand All @@ -85,15 +87,15 @@ jobs:
DEFAULT_BUMP: patch
RELEASE_BRANCHES: main
- name: Checkout two
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Extract version
run: |
echo "PACKAGE_VERSION=$(grep '^Version' DESCRIPTION | sed 's/.*: *//')" >> $GITHUB_ENV
echo "PACKAGE_NAME=$(grep '^Package' DESCRIPTION | sed 's/.*: *//')" >> $GITHUB_ENV

- name: Download binaries
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8

- name: Rename binaries release
shell: bash
Expand All @@ -104,13 +106,27 @@ jobs:
cp ./winOS/${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}*.zip .
echo "Renamed files"
ls infernet_*


- name: Extract release notes from NEWS.md
shell: bash
run: |
# Take the NEWS.md section for this version, else the topmost section.
awk -v ver="${{ env.PACKAGE_NAME }} ${{ env.PACKAGE_VERSION }}" '
/^# / { if (found) exit; if (substr($0, 3) == ver) { found = 1; next } }
found { print }
' NEWS.md > RELEASE_NOTES.md
if [ ! -s RELEASE_NOTES.md ]; then
awk 'NR > 1 && /^# / { exit } NR > 1 { print }' NEWS.md > RELEASE_NOTES.md
fi
cat RELEASE_NOTES.md

- name: Create Release and Upload Assets
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.newtag.outputs.tag }}
name: Release ${{ steps.newtag.outputs.tag }}
body_path: RELEASE_NOTES.md
draft: false
prerelease: false
fail_on_unmatched_files: true
Expand All @@ -120,7 +136,7 @@ jobs:
infernet_*.tar.gz
infernet_*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pkgdown:
name: Build and deploy website
Expand All @@ -130,11 +146,11 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v7

- uses: r-lib/actions/setup-r@v2

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r-dependencies@v2
with:
Expand All @@ -143,7 +159,7 @@ jobs:
any::rcmdcheck
any::pkgdown
any::rsconnect
needs: check
needs: website

- name: Install package
run: R CMD INSTALL .
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ CRAN-SUBMISSION
toadd/*
.data.csv
cache/*
.positai
29 changes: 29 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project overview

`infernet` is an R package (part of the [stocnet](https://github.com/stocnet) ecosystem) providing the *inferential layer* for network analysis:
conditional uniform graph (CUG) and quadratic assignment procedure (QAP) tests of network statistics, and multiple regression QAP (MRQAP).
It combines a formula front end with a range of estimator range, missing-data handling, and treatments for multimodal, multilevel, and cognitive social structure networks.
It builds on `{manynet}` (network classes and coercion) and `{netrics}` (measures),
so its functions accept matrices, edgelists, `{igraph}`, `{network}`, `{tidygraph}`, or `stocnet` objects,
and one-mode or two-mode networks alike.
Plotting results belongs in `{autograph}`.

Full package documentation — common dev commands, file organization, the `net_regression()` pipeline,
function body and parallelism conventions, console messaging, dependency practice, test conventions, `NEWS.md` conventions, and branching/CI — lives in [.github/CONTRIBUTING.md](.github/CONTRIBUTING.md).
Read it before adding or restructuring functions,
or when you need the exact `devtools`/testing commands for this repo.

Note that `{migraph}` still carries older copies of `net_regression()` and the `test_*()` family,
which `{infernet}` supersedes.
A fix made in `{migraph}` needs porting here; a fix made here does not need porting back.

## Where to make changes

- Make all changes on the `develop` branch. `develop` is the working branch; `main` is the release branch.
- Do not commit to `main` directly. Do not open a new feature branch for a fix unless the user asks.
- Keep changes reviewable. Leave them as an uncommitted working-tree diff on `develop`, or as local commits on `develop`. Commit only when the user asks.
- Do not push to `origin/develop` without explicit approval. `develop` is shared.
29 changes: 17 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
Package: infernet
Title: Basic inferential models for many different types of networks
Version: 0.1.0
Date: 2025-06-23
Description: TBD.
Title: Inferential Models for Many Different Types of Networks
Version: 0.1.1
Description: A set of tools for testing networks.
It includes functions for univariate and multivariate
conditional uniform graph and quadratic assignment procedure testing,
and multiple regression quadratic assignment procedure (MRQAP) models
for a range of families, with random and fixed effects,
missing data, and cognitive social structures.
Built on the 'manynet' package, all functions operate with matrices,
edge lists, and 'igraph', 'network', and 'tidygraph' objects,
and on one-mode and two-mode (bipartite) networks.
URL: https://stocnet.github.io/infernet/
BugReports: https://github.com/stocnet/infernet/issues
License: MIT + file LICENSE
Language: en-GB
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.3
Depends:
R (>= 3.6.0)
R (>= 4.1.0),
manynet (>= 2.3.1),
netrics (>= 1.0.1)
Authors@R:
c(person(given = "James",
family = "Hollway",
Expand All @@ -24,16 +32,11 @@ Authors@R:
comment = c(ORCID = "0000-0003-4288-4732"))
)
Imports:
cli,
dplyr,
furrr,
future,
future.apply,
manynet,
purrr,
reformulas,
stats,
utils
reformulas
Suggests:
lme4,
nnet,
Expand All @@ -56,3 +59,5 @@ Config/Needs/website:
pkgdown
Config/testthat/parallel: true
Config/testthat/edition: 3
Config/testthat/start-first: qap_estimators, model_tests
Config/roxygen2/version: 8.1.0
17 changes: 9 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ export(net_regression)
export(test_configuration)
export(test_permutation)
export(test_random)
importFrom(cli,cli_div)
importFrom(cli,cli_end)
importFrom(cli,cli_inform)
importFrom(manynet,bind_node_attributes)
importFrom(manynet,generate_configuration)
importFrom(manynet,generate_random)
importFrom(manynet,is_complex)
importFrom(manynet,is_directed)
importFrom(manynet,
bind_node_attributes,
generate_configuration,
generate_random,
is_complex,
is_directed,
snet_info
)
importFrom(netrics,net_by_heterophily)
Loading