Skip to content

v2.3.3 - #177

Merged
jhollway merged 13 commits into
mainfrom
develop
Sep 4, 2026
Merged

v2.3.3#177
jhollway merged 13 commits into
mainfrom
develop

Conversation

@jhollway

@jhollway jhollway commented Sep 4, 2026

Copy link
Copy Markdown
Member

Package

  • Added a fourth snet_verbosity level, 'debug', so each level has one job
    • 'normal' reports what a function chose, 'verbose' that it is running
    • snet_minor_info() moves to 'debug', so an interactive session is quieter

Classes

  • Added print() and summary() methods for a 'tie_member' class (closes Add print and summary methods for a tie_member class #168)
  • Improved add_info.stocnet() to check and conform the names it is given
    • Naming one nodeset of a two-mode network now aborts, as for an igraph
    • 'nodes' and 'ties' set the reserved 'modes' and 'layers'
    • An unrecognised field is kept, but warned about

Coercion

  • Fixed as_network() losing the graph attributes on the way through igraph
  • Fixed as_siena() rendering a node's non-response as a changing covariate

Making

  • Fixed generate_configuration() reading the modes of a 'stocnet'

Manipulating

  • Improved add_node_attribute() to take a vector as long as any one mode
    • Reads mode_nodes(), so it serves three or more modes and not only two

Marking

  • Fixed is_multilevel.igraph() marking a network that has no ties within a level

Modifying

  • Fixed to_labelled() storing labels that are not character

Tutorials

  • Fixed error in packaged data multichoice question

jhollway and others added 10 commits September 3, 2026 20:34
Each level now has one job. 'normal' reports what a function chose on the
user's behalf, 'verbose' reassures that a long task is running, and 'debug'
reports exhaustively what a function did on the way.

`snet_minor_info()` moves from 'verbose' to 'debug'. Its 30 call sites report
bookkeeping, such as which column was renamed, rather than progress. An
interactive session sets 'verbose' on attach, so it is quieter than before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
It wrote each name straight into the info, so naming one nodeset of a two-mode
network passed quietly where the igraph method aborts, and 'nodes' set a field
the class does not reserve. `to_mode()` could then not resolve a mode by name,
because the names had never reached 'modes'.

The recognised-field list and the checks are now shared with the igraph method,
and 'nodes' and 'ties' map onto 'modes' and 'layers' as `as_stocnet()` maps
them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…graph

`as_network.igraph()` and `as_network.tbl_graph()` copied node and tie
attributes but not graph attributes, so `as_network(as_igraph(x))` differed
from `as_network(x)` for any network carrying info.

The block that `as_network.stocnet()` already used is now a helper the three
share, so the names 'network' reserves for itself are still not overwritten,
and a per-layer 'directed' vector still travels as 'layer_directed'.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
An attribute of one mode, such as an attribute of the events of a two-mode
network, is as long as that mode and not as long as the network. The igraph
method already padded such a vector with NA; the stocnet method rejected it.

It reads `mode_nodes()` rather than `infer_dims()`, so it serves three or more
modes where the igraph route counts only two. A length that two modes share is
still an error rather than a guess.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
It asked for a 'type' node attribute, which is how an igraph marks the modes.
A stocnet marks them in 'mode', so the result was not logical and negating it
errored. It now asks `node_is_mode()`, which answers for every class.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A label is a name, so it is held as a character vector in every class. Given a
numeric vector, `to_labelled()` stored the numbers, which `validate_stocnet()`
then rejected because it reserves 'label' for character.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…a level

It returned TRUE as soon as a network carried a 'lvl' attribute, so any
network passed through `to_multilevel()` was marked multilevel, whether or not
its levels interlock. `ison_southern_women` ties only between its modes and is
not multilevel, but was marked so once levelled.

The levels are now read from 'lvl' or from 'type', and it is the ties that
decide, as `is_multilevel.stocnet()` already decided.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A caller naming one nodeset of a two-mode network now reads the same sentence
whether the network is a 'stocnet' or an igraph. A network of three or more
modes says how many it has instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 4, 2026 11:25
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.83673% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.43%. Comparing base (6c8b7e0) to head (228e116).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
R/manip_info.R 83.33% 3 Missing ⚠️
R/modif_labels.R 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #177   +/-   ##
=======================================
  Coverage   83.42%   83.43%           
=======================================
  Files          42       42           
  Lines        6783     6796   +13     
=======================================
+ Hits         5659     5670   +11     
- Misses       1124     1126    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

R/manip_nodes.R’s new .pad_to_modes() can mis-assign values when modes are not stored contiguously in the nodes table, which is a functional correctness issue.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR prepares the manynet v2.3.3 release by refining verbosity semantics, improving stocnet metadata/attribute handling (including coercion correctness), and updating tests/docs/tutorials to cover and communicate the new behaviors.

Changes:

  • Added a new snet_verbosity = "debug" level and moved snet_minor_info() reporting to that level.
  • Improved stocnet manipulation/coercion behaviors (info-name conformance/validation, add_node_attribute() mode-length vectors, generate_configuration() mode detection, and preserving graph attributes through igraph/tidygraph).
  • Fixed edge-case correctness issues (is_multilevel.igraph(), to_labelled() coercion to character) and updated tutorial content/questions accordingly.
File summaries
File Description
tests/testthat/test-manip_transform.R Adds coverage for resolving to_mode() by partial mode name on stocnet.
tests/testthat/test-manip_add.R Adds coverage for add_node_attribute() accepting mode-length vectors (incl. 3+ modes).
tests/testthat/test-make_generate.R Adds regression test ensuring generate_configuration() reads stocnet modes correctly.
tests/testthat/test-functional_manips.R Tests add_info.stocnet() name conformance and warnings for unrecognised fields.
tests/testthat/test-coercion.R Tests that as_network() preserves graph-level attributes through coercions.
tests/testthat/test-class_interface.R Updates tests for the new verbosity level ordering/behavior.
R/modif_labels.R Ensures labels/names are stored as character vectors for igraph/tidygraph.
R/mark_format.R Refines multilevel detection logic for igraph objects based on tie structure.
R/manip_nodes.R Adds .pad_to_modes() helper to support mode-length vectors for stocnet node attributes.
R/manip_info.R Adds info-name conformance (nodesmodes, tieslayers) and checks/warnings.
R/make_generate.R Uses node_is_mode() (mark) rather than raw type attribute to detect modes.
R/coerce_graph.R Preserves igraph graph attributes when converting to network and factors logic into set_network_info().
R/class_interface.R Adds "debug" verbosity level and adjusts snet_minor_info() threshold.
NEWS.md Adds v2.3.3 release notes and minor wording adjustments to prior notes.
man/progress.Rd Updates progress-bar verbosity documentation.
man/interface.Rd Updates interface/verbosity documentation for the new "debug" level.
inst/tutorials/manynet2/manipulating.html Regenerated tutorial HTML reflecting content/question changes.
inst/tutorials/manynet1/making.Rmd Fixes a tutorial question/answer text about counting rows displayed vs total.
inst/tutorials/manynet1/making.html Regenerated tutorial HTML reflecting the Rmd change.
DESCRIPTION Bumps package version to 2.3.3.
Review details

Files not reviewed (2)

  • man/interface.Rd: Generated file
  • man/progress.Rd: Generated file
  • Files reviewed: 18/20 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread R/manip_nodes.R
Comment on lines +439 to +448
.pad_to_modes <- function(vector, .data){
sizes <- mode_nodes(.data)
hits <- which(length(vector) == sizes)
if(net_modes(.data) < 2 || length(hits) != 1)
snet_abort(paste("The vector must be as long as the network has nodes:",
"{net_nodes(.data)}, not {length(vector)}."))
before <- sum(sizes[seq_len(hits - 1)])
after <- sum(sizes) - before - length(vector)
c(rep(NA, before), vector, rep(NA, after))
}
Comment thread R/manip_info.R Outdated
Comment on lines +190 to +193
# The fields a stocnet reserves, as `validate_info()` lists them, together with
# those that describe how a network was collected. An entry outside this list
# is kept, since a network may record more than the class reserves, but the
# user is told in case the name is a slip.
@jhollway
jhollway merged commit 7cba148 into main Sep 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add print and summary methods for a tie_member class

2 participants