Skip to content

Resolve membership to accept attribute name string or categorical vector#7

Closed
Copilot wants to merge 2 commits intodevelopfrom
copilot/sub-pr-5-again
Closed

Resolve membership to accept attribute name string or categorical vector#7
Copilot wants to merge 2 commits intodevelopfrom
copilot/sub-pr-5-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 21, 2026

membership was inconsistently typed across functions: brokerage functions called manynet::node_attribute(.data, membership) expecting a string, while feature functions used it directly as a vector. Users had no consistent way to pass either form.

Changes

R/netrics-utils.R

  • Added .resolve_membership(.data, membership) helper: if membership is a single string matching a node attribute name, retrieves that attribute vector; otherwise passes through as-is

R/motif_brokerage.R

  • Replaced all manynet::node_attribute(.data, membership) calls with .resolve_membership() in node_x_brokerage, net_x_brokerage, node_by_brokering_activity, node_by_brokering_exclusivity

R/measure_features.R

  • Added .resolve_membership() call (before NULL-check) in net_by_factions and net_by_modularity

man-roxygen/param_memb.R

  • Updated @param membership to document both accepted forms

Both calling styles now work uniformly:

# Pass an attribute name string
node_x_brokerage(ison_networkers, "Discipline")

# Pass a categorical vector directly
node_x_brokerage(ison_networkers, manynet::node_attribute(ison_networkers, "Discipline"))

Checklist:

  • Documentation
    • DESCRIPTION file version is bumped by the appropriate increment (major, minor, patch)
    • Date in DESCRIPTION is correct
    • Longer functions are commented inline or broken down into helper functions to help debugging
  • PR form
    • Title indicates expected version number
    • PR description above and the NEWS.md file are aligned
    • Description above itemizes changes under subsection titles, e.g. "## Data"
    • Closed, fixed, or related issues are referenced and explained in the description above, e.g. "Fixed #0 by adding A"

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI mentioned this pull request Mar 21, 2026
7 tasks
Copilot AI changed the title [WIP] [WIP] Address feedback on resolving membership for attribute input handling Resolve membership to accept attribute name string or categorical vector Mar 21, 2026
Copilot AI requested a review from jhollway March 21, 2026 19:18
@jhollway jhollway closed this Mar 22, 2026
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.

2 participants