Conversation
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>
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 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 movedsnet_minor_info()reporting to that level. - Improved
stocnetmanipulation/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 (nodes→modes, ties→layers) 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.
| .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)) | ||
| } |
| # 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. |
Package
snet_verbositylevel, 'debug', so each level has one jobsnet_minor_info()moves to 'debug', so an interactive session is quieterClasses
print()andsummary()methods for a 'tie_member' class (closes Add print and summary methods for atie_memberclass #168)add_info.stocnet()to check and conform the names it is givenCoercion
as_network()losing the graph attributes on the way through igraphas_siena()rendering a node's non-response as a changing covariateMaking
generate_configuration()reading the modes of a 'stocnet'Manipulating
add_node_attribute()to take a vector as long as any one modemode_nodes(), so it serves three or more modes and not only twoMarking
is_multilevel.igraph()marking a network that has no ties within a levelModifying
to_labelled()storing labels that are not characterTutorials